diff options
| author | Mark Otto <[email protected]> | 2012-03-23 18:29:21 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2012-03-23 18:29:21 -0700 |
| commit | f87e4c60e9bb33f29bffed702af797b322821b8f (patch) | |
| tree | 64c0663ec3ef31ea3fedd9af6ed10826d10bcbc4 /js/bootstrap-carousel.js | |
| parent | a57554222f091ed3905259b32d1f1a3786e37200 (diff) | |
| parent | b3bf223617754e658eb62ef0f068732e719a2c82 (diff) | |
| download | bootstrap-f87e4c60e9bb33f29bffed702af797b322821b8f.tar.xz bootstrap-f87e4c60e9bb33f29bffed702af797b322821b8f.zip | |
Merge branch '2.1.0-wip' into 2.0.3-wip
Conflicts:
docs/assets/bootstrap.zip
Diffstat (limited to 'js/bootstrap-carousel.js')
| -rw-r--r-- | js/bootstrap-carousel.js | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/js/bootstrap-carousel.js b/js/bootstrap-carousel.js index 8c0723d28..7db5bea33 100644 --- a/js/bootstrap-carousel.js +++ b/js/bootstrap-carousel.js @@ -27,7 +27,7 @@ var Carousel = function (element, options) { this.$element = $(element) - this.options = $.extend({}, $.fn.carousel.defaults, options) + this.options = options this.options.slide && this.slide(this.options.slide) this.options.pause == 'hover' && this.$element .on('mouseenter', $.proxy(this.pause, this)) @@ -37,7 +37,8 @@ Carousel.prototype = { cycle: function () { - this.interval = setInterval($.proxy(this.next, this), this.options.interval) + this.options.interval + && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) return this } @@ -94,13 +95,7 @@ if ($next.hasClass('active')) return - if (!$.support.transition && this.$element.hasClass('slide')) { - this.$element.trigger('slide') - $active.removeClass('active') - $next.addClass('active') - this.sliding = false - this.$element.trigger('slid') - } else { + if ($.support.transition && this.$element.hasClass('slide')) { $next.addClass(type) $next[0].offsetWidth // force reflow $active.addClass(direction) @@ -112,6 +107,12 @@ that.sliding = false setTimeout(function () { that.$element.trigger('slid') }, 0) }) + } else { + this.$element.trigger('slide') + $active.removeClass('active') + $next.addClass('active') + this.sliding = false + this.$element.trigger('slid') } isCycling && this.cycle() @@ -129,11 +130,11 @@ return this.each(function () { var $this = $(this) , data = $this.data('carousel') - , options = typeof option == 'object' && option + , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option) if (!data) $this.data('carousel', (data = new Carousel(this, options))) if (typeof option == 'number') data.to(option) else if (typeof option == 'string' || (option = options.slide)) data[option]() - else data.cycle() + else if (options.interval) data.cycle() }) } |
