diff --git a/1.3.0/bootstrap-modal.js b/1.3.0/bootstrap-modal.js index 3267560e..76c49525 100644 --- a/1.3.0/bootstrap-modal.js +++ b/1.3.0/bootstrap-modal.js @@ -57,12 +57,10 @@ this.$element = $(content) .delegate('.close', 'click.modal', $.proxy(this.hide, this)) - if ( options ) { - $.extend( this.settings, options ) + $.extend( this.settings, options ) - if ( options.show ) { - this.show() - } + if ( this.settings.show ) { + this.show() } return this @@ -81,17 +79,23 @@ escape.call(this) backdrop.call(this, function () { + var transition = $.support.transition && that.$element.hasClass('fade') + that.$element .appendTo(document.body) .show() - if ($.support.transition && that.$element.hasClass('fade')) { + if (transition) { that.$element[0].offsetWidth // force reflow } that.$element .addClass('in') - .trigger('shown') + + transition ? + that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) : + that.$element.trigger('shown') + }) return this @@ -100,6 +104,10 @@ , hide: function (e) { e && e.preventDefault() + if ( !this.isShown ) { + return this + } + var that = this this.isShown = false @@ -220,7 +228,7 @@ $.fn.modal.defaults = { backdrop: false , keyboard: false - , show: true + , show: false } @@ -235,4 +243,4 @@ }) }) -}( window.jQuery || window.ender ); \ No newline at end of file +}( window.jQuery || window.ender ); diff --git a/1.3.0/bootstrap-tabs.js b/1.3.0/bootstrap-tabs.js index dece95be..e0286a36 100644 --- a/1.3.0/bootstrap-tabs.js +++ b/1.3.0/bootstrap-tabs.js @@ -27,21 +27,27 @@ function tab( e ) { var $this = $(this) - , href = $this.attr('href') , $ul = $this.closest('ul') - , $controlled + , href = $this.attr('href') + , previous if (/^#\w+/.test(href)) { e.preventDefault() - if ($this.hasClass('active')) { + if ($this.parent('li').hasClass('active')) { return } + previous = $ul.find('.active a')[0] $href = $(href) activate($this.parent('li'), $ul) activate($href, $href.parent()) + + $this.trigger({ + type: 'change' + , relatedTarget: previous + }) } } @@ -59,4 +65,4 @@ $('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a') }) -}( window.jQuery || window.ender ); \ No newline at end of file +}( window.jQuery || window.ender );