diff options
| author | Mark Otto <[email protected]> | 2012-01-08 14:33:52 -0800 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2012-01-08 14:33:52 -0800 |
| commit | ac68bc39ff46aec1d4654165eb64c2dc11f5e968 (patch) | |
| tree | ceab3321ac91d267030639c24e4ab6815c5d84ee | |
| parent | 2c790304393cce3ba7db3b3d5bc9385b1986b838 (diff) | |
| parent | 5a33c1b96e13a4650a127b0e81a91eb235561170 (diff) | |
| download | bootstrap-ac68bc39ff46aec1d4654165eb64c2dc11f5e968.tar.xz bootstrap-ac68bc39ff46aec1d4654165eb64c2dc11f5e968.zip | |
Merge branch '2.0-wip' of github.com:twitter/bootstrap into 2.0-wip
| -rw-r--r-- | docs/javascript.html | 53 | ||||
| -rw-r--r-- | js/bootstrap-carousel.js | 10 | ||||
| -rw-r--r-- | js/bootstrap-dropdown.js | 4 |
3 files changed, 50 insertions, 17 deletions
diff --git a/docs/javascript.html b/docs/javascript.html index a63350c3d..a46813ad8 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -350,7 +350,7 @@ $('#myModal').on('hidden', function () { <li><a href="#fat">@fat</a></li> <li><a href="#mdo">@mdo</a></li> <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="#one">one</a></li> <li><a href="#two">two</a></li> @@ -1046,21 +1046,42 @@ $('#myCollapsible').on('hidden', function () { </div> </pre> -<h3>Methods</h3> -<h4>.carousel(options)</h4> -<p>Initializes the carousel with an optional options <code>object</code> and starts cycling through items.</p> -<pre class="prettyprint linenums"> -$('.myCarousel').carousel({ - interval: 2000 -})</pre> -<h4>.carousel('cycle')</h4> -<p>Cycles through the carousel items from left to right.</p> -<h4>.carousel('pause')</h4> -<p>Stops the carousel from cycling through items.</p> -<h4>.carousel('prev')</h4> -<p>Cycles to the previous item.</p> -<h4>.carousel('next')</h4> -<p>Cycles to the next item.</p> + <h3>Methods</h3> + <h4>.carousel(options)</h4> + <p>Initializes the carousel with an optional options <code>object</code> and starts cycling through items.</p> + <pre class="prettyprint linenums"> + $('.myCarousel').carousel({ + interval: 2000 + })</pre> + <h4>.carousel('cycle')</h4> + <p>Cycles through the carousel items from left to right.</p> + <h4>.carousel('pause')</h4> + <p>Stops the carousel from cycling through items.</p> + <h4>.carousel('prev')</h4> + <p>Cycles to the previous item.</p> + <h4>.carousel('next')</h4> + <p>Cycles to the next item.</p> + <h3>Events</h3> + <p>Bootstrap's modal class exposes a few events for hooking into modal functionality. </p> + <table class="bordered-table striped-table"> + <thead> + <tr> + <th style="width: 150px;">Event</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <td>slide</td> + <td>This event fires immediately when the <code>slide</code> instance method is invoked.</td> + </tr> + <tr> + <td>slid</td> + <td>This event is fired when the carousel has completed it's slide transition.</td> + </tr> + </tr> + </tbody> + </table> <h3>Demo</h3> <!-- carousel --> 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 }) } 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 } |
