vendor/assets/javascripts/bootstrap/bootstrap-collapse.js in jombo-1.0.1 vs vendor/assets/javascripts/bootstrap/bootstrap-collapse.js in jombo-1.0.2

- old
+ new

@@ -1,7 +1,7 @@ /* ============================================================= - * bootstrap-collapse.js v2.0.0 + * bootstrap-collapse.js v2.0.2 * http://twitter.github.com/bootstrap/javascript.html#collapse * ============================================================= * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -40,29 +40,37 @@ var hasWidth = this.$element.hasClass('width') return hasWidth ? 'width' : 'height' } , show: function () { - var dimension = this.dimension() - , scroll = $.camelCase(['scroll', dimension].join('-')) - , actives = this.$parent && this.$parent.find('.in') + var dimension + , scroll + , actives , hasData + if (this.transitioning) return + + dimension = this.dimension() + scroll = $.camelCase(['scroll', dimension].join('-')) + actives = this.$parent && this.$parent.find('> .accordion-group > .in') + hasData + if (actives && actives.length) { hasData = actives.data('collapse') actives.collapse('hide') hasData || actives.data('collapse', null) } this.$element[dimension](0) this.transition('addClass', 'show', 'shown') this.$element[dimension](this.$element[0][scroll]) - } , hide: function () { - var dimension = this.dimension() + var dimension + if (this.transitioning) return + dimension = this.dimension() this.reset(this.$element[dimension]()) this.transition('removeClass', 'hide', 'hidden') this.$element[dimension](0) } @@ -72,20 +80,25 @@ this.$element .removeClass('collapse') [dimension](size || 'auto') [0].offsetWidth - this.$element.addClass('collapse') + this.$element[size != null ? 'addClass' : 'removeClass']('collapse') + + return this } , transition: function ( method, startEvent, completeEvent ) { var that = this , complete = function () { if (startEvent == 'show') that.reset() + that.transitioning = 0 that.$element.trigger(completeEvent) } + this.transitioning = 1 + this.$element .trigger(startEvent) [method]('in') $.support.transition && this.$element.hasClass('collapse') ? @@ -131,6 +144,6 @@ , option = $(target).data('collapse') ? 'toggle' : $this.data() $(target).collapse(option) }) }) -}( window.jQuery ) +}( window.jQuery ); \ No newline at end of file