aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2011-10-19 23:12:50 -0700
committerJacob Thornton <[email protected]>2011-10-19 23:12:50 -0700
commit523e02f7df3bb706654b43cf604e61c9396212e1 (patch)
tree5c835652ac9f49a82934227b63e79589edbe24d9 /js
parent5ab84f942dadc02db57fbe9dbcc619a5eae3920a (diff)
downloadbootstrap-523e02f7df3bb706654b43cf604e61c9396212e1.tar.xz
bootstrap-523e02f7df3bb706654b43cf604e61c9396212e1.zip
fix scrollspy simplify stuff more - break everything.
Diffstat (limited to 'js')
-rw-r--r--js/bootstrap-accordion.js2
-rw-r--r--js/bootstrap-alerts.js2
-rw-r--r--js/bootstrap-dropdown.js5
-rw-r--r--js/bootstrap-modal.js2
-rw-r--r--js/bootstrap-popover.js2
-rw-r--r--js/bootstrap-scrollspy.js33
-rw-r--r--js/bootstrap-tabs.js21
-rw-r--r--js/bootstrap-twipsy.js2
-rw-r--r--js/tests/index.html1
9 files changed, 44 insertions, 26 deletions
diff --git a/js/bootstrap-accordion.js b/js/bootstrap-accordion.js
index b88057691..9a24b5ddf 100644
--- a/js/bootstrap-accordion.js
+++ b/js/bootstrap-accordion.js
@@ -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.
diff --git a/js/bootstrap-alerts.js b/js/bootstrap-alerts.js
index bac92deb8..4f1acfa3d 100644
--- a/js/bootstrap-alerts.js
+++ b/js/bootstrap-alerts.js
@@ -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.
diff --git a/js/bootstrap-dropdown.js b/js/bootstrap-dropdown.js
index 6d9430b39..d12fe48cb 100644
--- a/js/bootstrap-dropdown.js
+++ b/js/bootstrap-dropdown.js
@@ -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()
diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js
index 02f8b2382..984b091d6 100644
--- a/js/bootstrap-modal.js
+++ b/js/bootstrap-modal.js
@@ -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.
diff --git a/js/bootstrap-popover.js b/js/bootstrap-popover.js
index 22db98fd9..3fdde19b5 100644
--- a/js/bootstrap-popover.js
+++ b/js/bootstrap-popover.js
@@ -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.
diff --git a/js/bootstrap-scrollspy.js b/js/bootstrap-scrollspy.js
index 23bdf59e9..1269d91ec 100644
--- a/js/bootstrap-scrollspy.js
+++ b/js/bootstrap-scrollspy.js
@@ -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.
@@ -22,14 +22,14 @@
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
@@ -56,27 +56,34 @@
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
diff --git a/js/bootstrap-tabs.js b/js/bootstrap-tabs.js
index 6ee80429c..86bd4784f 100644
--- a/js/bootstrap-tabs.js
+++ b/js/bootstrap-tabs.js
@@ -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.
@@ -21,24 +21,33 @@
!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)
diff --git a/js/bootstrap-twipsy.js b/js/bootstrap-twipsy.js
index c44395e08..7c195fbc7 100644
--- a/js/bootstrap-twipsy.js
+++ b/js/bootstrap-twipsy.js
@@ -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
* ==========================================================
diff --git a/js/tests/index.html b/js/tests/index.html
index 2ca94102a..617fcd92a 100644
--- a/js/tests/index.html
+++ b/js/tests/index.html
@@ -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>