]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
fix scrollspy simplify stuff more - break everything.
authorJacob Thornton <jacobthornton@gmail.com>
Thu, 20 Oct 2011 06:12:50 +0000 (23:12 -0700)
committerJacob Thornton <jacobthornton@gmail.com>
Thu, 20 Oct 2011 06:12:50 +0000 (23:12 -0700)
docs/index.html
js/bootstrap-accordion.js
js/bootstrap-alerts.js
js/bootstrap-dropdown.js
js/bootstrap-modal.js
js/bootstrap-popover.js
js/bootstrap-scrollspy.js
js/bootstrap-tabs.js
js/bootstrap-twipsy.js
js/tests/index.html

index aafea7662198a57420a81c9e9a7f7bb24352b907..255d1684fba314c28c7dcc45d1eb92442634d888 100644 (file)
@@ -53,8 +53,8 @@
             <li class="dropdown">
               <a href="#" class="dropdown-toggle" data-dropdown="true">Patterns</a>
               <ul class="dropdown-menu">
-                <li><a href="#navigation">Navigation</a></li>
                 <li><a href="#media">Media</a></li>
+                <li><a href="#navigation">Navigation</a></li>
                 <li><a href="#alerts">Alerts</a></li>
                 <li><a href="#popovers">Popovers</a></li>
                 <li><a href="#autocomplete">Autocomplete</a></li>
 
       <!-- About Bootstrap
       ================================================== -->
-      <div class="row">
-        <div class="span4">
-          <h2>Built for and by nerds</h2>
-          <p>Engineers at Twitter have historically used almost any library they were familiar with to meet front-end requirements. Bootstrap began as an answer to the challenges that presented. With the help of many awesome folks, Bootstrap has grown significantly.</p>
-          <p>Read more on <a href="https://dev.twitter.com/blog/bootstrap-twitter">dev.twitter.com &rsaquo;</a></p>
-        </div>
-        <div class="span4">
-          <h2>Cross-everything</h2>
-          <p>Bootstrap is tested and supported in major modern browsers like Chrome, Safari, Internet Explorer, and Firefox.</p>
-          <img class="browser-support" src="assets/img/browsers.png" alt="Tested and supported in Chrome, Safari, Internet Explorer, and Firefox">
-          <ul>
-            <li>Latest Safari</li>
-            <li>Latest Google Chrome</li>
-            <li>Firefox 4+</li>
-            <li>Internet Explorer 7+</li>
-            <li>Opera 11</li>
-          </ul>
-        </div>
-        <div class="span4">
-          <h2>What's included</h2>
-          <p>Bootstrap comes complete with compiled CSS, uncompiled, and example templates.</p>
-          <ul>
-            <li><span class="label">New in 1.3</span> <a href="./javascript.html">Javascript plugins</a></li>
-            <li>All original .less files</li>
-            <li>Fully <a href="../bootstrap.css">compiled</a> and <a href="../bootstrap.min.css">minified</a> CSS</li>
-            <li>Complete styleguide documentation</li>
-            <li>Three example pages with different layouts</li>
-          </ul>
-        </div>
-      </div><!-- /row -->
+      <section id="about">
+        <div class="row">
+          <div class="span4">
+            <h2>Built for and by nerds</h2>
+            <p>Engineers at Twitter have historically used almost any library they were familiar with to meet front-end requirements. Bootstrap began as an answer to the challenges that presented. With the help of many awesome folks, Bootstrap has grown significantly.</p>
+            <p>Read more on <a href="https://dev.twitter.com/blog/bootstrap-twitter">dev.twitter.com &rsaquo;</a></p>
+          </div>
+          <div class="span4">
+            <h2>Cross-everything</h2>
+            <p>Bootstrap is tested and supported in major modern browsers like Chrome, Safari, Internet Explorer, and Firefox.</p>
+            <img class="browser-support" src="assets/img/browsers.png" alt="Tested and supported in Chrome, Safari, Internet Explorer, and Firefox">
+            <ul>
+              <li>Latest Safari</li>
+              <li>Latest Google Chrome</li>
+              <li>Firefox 4+</li>
+              <li>Internet Explorer 7+</li>
+              <li>Opera 11</li>
+            </ul>
+          </div>
+          <div class="span4">
+            <h2>What's included</h2>
+            <p>Bootstrap comes complete with compiled CSS, uncompiled, and example templates.</p>
+            <ul>
+              <li><span class="label">New in 1.3</span> <a href="./javascript.html">Javascript plugins</a></li>
+              <li>All original .less files</li>
+              <li>Fully <a href="../bootstrap.css">compiled</a> and <a href="../bootstrap.min.css">minified</a> CSS</li>
+              <li>Complete styleguide documentation</li>
+              <li>Three example pages with different layouts</li>
+            </ul>
+          </div>
+        </div><!-- /row -->
+      </section>
 
       <h3>Quick-start examples</h3>
       <p>Need some quick templates? Check out these basic examples we've put together:</p>
@@ -2162,6 +2164,7 @@ Lorem ipsum dolar sit amet illo error <a href="#" title="below">ipsum</a> verita
     <script src="http://autobahn.tablesorter.com/jquery.tablesorter.min.js"></script>
     <script src="assets/js/google-code-prettify/prettify.js"></script>
     <script>$(function () { prettyPrint() })</script>
+    <script src="../js/bootstrap-transitions.js"></script>
     <script src="../js/bootstrap-dropdown.js"></script>
     <script src="../js/bootstrap-twipsy.js"></script>
     <script src="../js/bootstrap-scrollspy.js"></script>
index b88057691d7804f52cac53e9ade12bdca6bc2a03..9a24b5ddfcf3960f1562cb57c427aab37b36581a 100644 (file)
@@ -1,5 +1,5 @@
 /* =============================================================
- * bootstrap-accordion.js v1.3.0
+ * bootstrap-accordion.js v2.0.0
  * http://twitter.github.com/bootstrap/javascript.html#accordion
  * =============================================================
  * Copyright 2011 Twitter, Inc.
index bac92deb8aa4e3a114d5647a6eca55280f10d991..4f1acfa3d0d8ce4cda91dd5b5ba3fe6f8f543225 100644 (file)
@@ -1,5 +1,5 @@
 /* ==========================================================
- * bootstrap-alerts.js v1.3.0
+ * bootstrap-alerts.js v2.0.0
  * http://twitter.github.com/bootstrap/javascript.html#alerts
  * ==========================================================
  * Copyright 2011 Twitter, Inc.
index 6d9430b391704b0ff928f315152464600f8c072f..d12fe48cb6742f2dc0888b84792f58cddb9fe576 100644 (file)
@@ -1,5 +1,5 @@
 /* ============================================================
- * bootstrap-dropdown.js v1.3.0
+ * bootstrap-dropdown.js v2.0.0
  * http://twitter.github.com/bootstrap/javascript.html#dropdown
  * ============================================================
  * Copyright 2011 Twitter, Inc.
@@ -22,6 +22,7 @@
 
   /* APPLY TO STANDARD DROPDOWN ELEMENTS
    * =================================== */
+  var selector = '[data-dropdown]'
 
   function clearMenus() {
     $(selector).parent('li').removeClass('open')
@@ -29,7 +30,7 @@
 
   $(function () {
     $('html').bind("click", clearMenus)
-    $('body').delegate('[data-dropdown]', 'click', function (e) {
+    $('body').delegate(selector, 'click', function (e) {
       var li = $(this).parent('li')
         , isActive = li.hasClass('open')
       clearMenus()
index 02f8b2382799fc6098e3ad15c8959bf09f7e1460..984b091d61ede2f58fc60265be86eb0876ada52f 100644 (file)
@@ -1,5 +1,5 @@
 /* =========================================================
- * bootstrap-modal.js v1.3.0
+ * bootstrap-modal.js v2.0.0
  * http://twitter.github.com/bootstrap/javascript.html#modal
  * =========================================================
  * Copyright 2011 Twitter, Inc.
index 22db98fd9b882f666ae40148b19acb7e1b95303b..3fdde19b518277ef490ef01afae0ca0a72b67b3e 100644 (file)
@@ -1,5 +1,5 @@
 /* ===========================================================
- * bootstrap-popover.js v1.3.0
+ * bootstrap-popover.js v2.0.0
  * http://twitter.github.com/bootstrap/javascript.html#popover
  * ===========================================================
  * Copyright 2011 Twitter, Inc.
index 23bdf59e9c84cdb65ffdfccf253c221718a5949b..1269d91ecbe4b231dee9bddef78d460179e027c0 100644 (file)
@@ -1,5 +1,5 @@
 /* =============================================================
- * bootstrap-scrollspy.js v1.3.0
+ * bootstrap-scrollspy.js v2.0.0
  * http://twitter.github.com/bootstrap/javascript.html#scrollspy
  * =============================================================
  * Copyright 2011 Twitter, Inc.
 
   var $window = $(window)
 
-  function ScrollSpy( topbar, selector ) {
-    var processScroll = $.proxy(this.processScroll, this)
-    this.$topbar = $(topbar)
-    this.selector = selector || 'li > a'
+  function ScrollSpy() {
+    var process = $.proxy(this.process, this)
+    this.$topbar = $('body')
+    this.selector = '[data-scrollspy] li > a'
     this.refresh()
-    this.$topbar.delegate(this.selector, 'click', processScroll)
-    $window.scroll(processScroll)
-    this.processScroll()
+    this.$topbar.delegate(this.selector, 'click', process)
+    $window.scroll(process)
+    this.process()
   }
 
   ScrollSpy.prototype = {
@@ -45,7 +45,7 @@
         })
       }
 
-    , processScroll: function () {
+    , process: function () {
         var scrollTop = $window.scrollTop() + 10
           , offsets = this.offsets
           , targets = this.targets
           activeTarget != targets[i]
             && scrollTop >= offsets[i]
             && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
-            && this.activateButton( targets[i] )
+            && this.activate( targets[i] )
         }
       }
 
-    , activateButton: function (target) {
+    , activate: function (target) {
+        var active
+
         this.activeTarget = target
 
         this.$topbar
           .find(this.selector).parent('.active')
           .removeClass('active')
 
-        this.$topbar
+        active = this.$topbar
           .find(this.selector + '[href="' + target + '"]')
           .parent('li')
           .addClass('active')
+
+        if ( active.parent('.dropdown-menu') )  {
+          active.closest('li.dropdown').addClass('active')
+        }
+
       }
 
   }
 
   $(function () {
-    $('body').scrollSpy('[data-scrollspy] li > a')
+    new ScrollSpy()
   })
 
 }( window.jQuery || window.ender )
\ No newline at end of file
index 6ee80429c784d635e731241f0a71ed11b25d3b5b..86bd4784f3fd5e44e025fb769ef4ef52f6f4e90f 100644 (file)
@@ -1,5 +1,5 @@
 /* ========================================================
- * bootstrap-tabs.js v1.3.0
+ * bootstrap-tabs.js v2.0.0
  * http://twitter.github.com/bootstrap/javascript.html#tabs
  * ========================================================
  * Copyright 2011 Twitter, Inc.
 !function( $ ){
 
   function activate ( element, container ) {
-    container.find('> .active').removeClass('active')
+    container
+      .find('> .active')
+      .removeClass('active')
+      .find('> .dropdown-menu > .active')
+      .removeClass('active')
+
     element.addClass('active')
+
+    if ( element.parent('.dropdown-menu') ) {
+      element.closest('li.dropdown').addClass('active')
+    }
   }
 
   function tab( e ) {
     var $this = $(this)
-      , $ul = $this.closest('ul')
+      , $ul = $this.closest('ul:not(.dropdown-menu)')
       , href = $this.attr('href')
       , previous
 
-    if (/^#\w+/.test(href)) {
+    if ( /^#\w+/.test(href) ) {
       e.preventDefault()
 
-      if ($this.parent('li').hasClass('active')) {
+      if ( $this.parent('li').hasClass('active') ) {
         return
       }
 
-      previous = $ul.find('.active a')[0]
+      previous = $ul.find('.active a').last()[0]
       $href = $(href)
 
       activate($this.parent('li'), $ul)
index c44395e08ec00114ac15c88a75f9ea8a5504e739..7c195fbc78ac7b785fe82e034fcc683fe33a3799 100644 (file)
@@ -1,5 +1,5 @@
 /* ==========================================================
- * bootstrap-twipsy.js v1.3.0
+ * bootstrap-twipsy.js v2.0.0
  * http://twitter.github.com/bootstrap/javascript.html#twipsy
  * Adapted from the original jQuery.tipsy by Jason Frame
  * ==========================================================
index 2ca94102ad32752ec1d4cb1809725454f9daeaf0..617fcd92abfd29a3d9cc6c4240b455758d951589 100644 (file)
@@ -11,6 +11,7 @@
   <script src="vendor/qunit.js"></script>
 
   <!--  plugin sources -->
+  <script src="../../js/bootstrap-transitions.js"></script>
   <script src="../../js/bootstrap-alerts.js"></script>
   <script src="../../js/bootstrap-dropdown.js"></script>
   <script src="../../js/bootstrap-modal.js"></script>