aboutsummaryrefslogtreecommitdiff
path: root/docs/assets
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2011-09-10 22:14:57 -0700
committerJacob Thornton <[email protected]>2011-09-10 22:14:57 -0700
commit64176caa972fdf925fe244cdbf1d53d82da592f4 (patch)
tree413ff6c850a038be203b64526caca958db1487c6 /docs/assets
parenta71d5d8e991eee4073d3312743778b1991cfb650 (diff)
downloadbootstrap-64176caa972fdf925fe244cdbf1d53d82da592f4.tar.xz
bootstrap-64176caa972fdf925fe244cdbf1d53d82da592f4.zip
add bootstrap-scrollspy
Diffstat (limited to 'docs/assets')
-rw-r--r--docs/assets/js/application-scrollspy.js39
-rw-r--r--docs/assets/js/application.js6
2 files changed, 6 insertions, 39 deletions
diff --git a/docs/assets/js/application-scrollspy.js b/docs/assets/js/application-scrollspy.js
deleted file mode 100644
index 1f0b7cebe..000000000
--- a/docs/assets/js/application-scrollspy.js
+++ /dev/null
@@ -1,39 +0,0 @@
-// scroll spy logic
-// ================
-$(function () {
-
- var activeTarget,
- position = {},
- $window = $(window),
- nav = $('body > .topbar li a'),
- targets = nav.map(function () {
- return $(this).attr('href');
- }),
- offsets = $.map(targets, function (id) {
- return $(id).offset().top;
- });
-
- function setButton(id) {
- nav.parent("li").removeClass('active');
- $(nav[$.inArray(id, targets)]).parent("li").addClass('active');
- }
-
- function processScroll(e) {
- var scrollTop = $window.scrollTop() + 10, i;
- for (i = offsets.length; i--;) {
- if (activeTarget != targets[i] && scrollTop >= offsets[i] && (!offsets[i + 1] || scrollTop <= offsets[i + 1])) {
- activeTarget = targets[i];
- setButton(activeTarget);
- }
- }
- }
-
- nav.click(function () {
- processScroll();
- });
-
- processScroll();
-
- $window.scroll(processScroll);
-
-}) \ No newline at end of file
diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js
index 86eefa89d..d1c6751ea 100644
--- a/docs/assets/js/application.js
+++ b/docs/assets/js/application.js
@@ -6,6 +6,12 @@ $(document).ready(function(){
$('body').dropdown() // catch any dropdowns on the page
+ // Scrollspy
+ // =========
+
+ $('body > .topbar').scrollSpy()
+
+
// table sort example
// ==================