]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
add slide and slid events + disable sliding during slide
authorJacob Thornton <jacobthornton@gmail.com>
Sun, 8 Jan 2012 21:39:27 +0000 (13:39 -0800)
committerJacob Thornton <jacobthornton@gmail.com>
Sun, 8 Jan 2012 21:39:27 +0000 (13:39 -0800)
js/bootstrap-carousel.js

index fa5247c97eaedbc8f783d26b16d9a5e39ae5fe7d..c49f89ad809bc5859f486072f4fac6d8fcbe8b7b 100644 (file)
     }
 
   , next: function () {
+      if (this.sliding) return
       return this.slide('next')
     }
 
   , prev: function () {
+      if (this.sliding) return
       return this.slide('prev')
     }
 
         , fallback  = type == 'next' ? 'first' : 'last'
         , that = this
 
+      this.sliding = true
+
       isCycling && this.pause()
 
       $next = $next.length ? $next : this.$element.find('.item')[fallback]()
 
       if (!$.support.transition && this.$element.hasClass('slide')) {
+        this.$element.trigger('slide')
         $active.removeClass('active')
         $next.addClass('active')
+        this.$element.trigger('slid')
+        this.sliding = false
       } else {
         $next.addClass(type)
         $next[0].offsetWidth // force reflow
         $active.addClass(direction)
         $next.addClass(direction)
+        this.$element.trigger('slide')
         this.$element.one($.support.transition.end, function () {
           $next.removeClass([type, direction].join(' ')).addClass('active')
           $active.removeClass(['active', direction].join(' '))
+          that.$element.trigger('slid')
+          that.sliding = false
         })
       }