From f83240a8f93349c93582a96c4f4a7541388d6a80 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sun, 8 Jan 2012 13:39:27 -0800 Subject: add slide and slid events + disable sliding during slide --- js/bootstrap-carousel.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'js') diff --git a/js/bootstrap-carousel.js b/js/bootstrap-carousel.js index fa5247c97..c49f89ad8 100644 --- a/js/bootstrap-carousel.js +++ b/js/bootstrap-carousel.js @@ -44,10 +44,12 @@ } , next: function () { + if (this.sliding) return return this.slide('next') } , prev: function () { + if (this.sliding) return return this.slide('prev') } @@ -59,21 +61,29 @@ , 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 }) } -- cgit v1.2.3 From 5a33c1b96e13a4650a127b0e81a91eb235561170 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sun, 8 Jan 2012 14:19:53 -0800 Subject: make dropdowns toggle when clicked (for mobile) --- js/bootstrap-dropdown.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/bootstrap-dropdown.js b/js/bootstrap-dropdown.js index d846f1af1..3cb261992 100644 --- a/js/bootstrap-dropdown.js +++ b/js/bootstrap-dropdown.js @@ -38,12 +38,14 @@ var $this = $(this) , selector = $this.attr('data-target') || $this.attr('href') , $parent = $(selector) + , isActive $parent.length || ($parent = $this.parent()) + isActive = $parent.hasClass('open') clearMenus() - !$parent.hasClass('open') && $parent.toggleClass('open') + !isActive && $parent.toggleClass('open') return false } -- cgit v1.2.3