vendor/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js in twitter-bootstrap-rails-2.0.3 vs vendor/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js in twitter-bootstrap-rails-2.0.4

- old
+ new

@@ -1,7 +1,7 @@ /* ========================================================== - * bootstrap-carousel.js v2.0.1 + * bootstrap-carousel.js v2.0.2 * http://twitter.github.com/bootstrap/javascript.html#carousel * ========================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,10 +27,13 @@ var Carousel = function (element, options) { this.$element = $(element) this.options = $.extend({}, $.fn.carousel.defaults, options) this.options.slide && this.slide(this.options.slide) + this.options.pause == 'hover' && this.$element + .on('mouseenter', $.proxy(this.pause, this)) + .on('mouseleave', $.proxy(this.cycle, this)) } Carousel.prototype = { cycle: function () { @@ -81,18 +84,18 @@ , isCycling = this.interval , direction = type == 'next' ? 'left' : 'right' , fallback = type == 'next' ? 'first' : 'last' , that = this - if (!$next.length) return - this.sliding = true isCycling && this.pause() $next = $next.length ? $next : this.$element.find('.item')[fallback]() + 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 @@ -134,9 +137,10 @@ }) } $.fn.carousel.defaults = { interval: 5000 + , pause: 'hover' } $.fn.carousel.Constructor = Carousel \ No newline at end of file