From 5e5e87fbd0f577256d8a2b479bb9ed2187ff7f91 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Tue, 24 Jan 2012 22:33:33 -0800 Subject: [PATCH 1/3] scrollspy working for sub navs --- docs/assets/js/application.js | 2 +- docs/javascript.html | 26 +++++++++++++------------- js/bootstrap-scrollspy.js | 15 +++++++++------ 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index 0252d75e96..84227f5557 100644 --- a/docs/assets/js/application.js +++ b/docs/assets/js/application.js @@ -119,7 +119,7 @@ $(function(){ // fix sub nav playa var $win = $(window) , $nav = $('.subnav') - , navTop = $('.subnav').offset().top - 40 + , navTop = $('.subnav').length && $('.subnav').offset().top - 40 , isFixed = 0 processScroll() diff --git a/docs/javascript.html b/docs/javascript.html index 425d347cb8..8cf95c8153 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -24,7 +24,7 @@ - + @@ -65,18 +65,18 @@

Bring Bootstrap's components to life—now with 12 custom jQuery plugins.

diff --git a/js/bootstrap-scrollspy.js b/js/bootstrap-scrollspy.js index 5049bfdf95..91c49f32ee 100644 --- a/js/bootstrap-scrollspy.js +++ b/js/bootstrap-scrollspy.js @@ -26,10 +26,11 @@ function ScrollSpy( element, options) { var process = $.proxy(this.process, this) + , $element = $(element).is('body') ? $(window) : $(element) this.options = $.extend({}, $.fn.scrollspy.defaults, options) - this.$scrollElement = $(element).on('scroll.scroll.data-api', process) - this.selector = (this.$scrollElement.attr('data-target') - || this.$scrollElement.attr('href') + this.$scrollElement = $element.on('scroll.scroll.data-api', process) + this.selector = (this.options.target + || $(element).attr('href') || '') + ' .nav li > a' this.$body = $('body').on('click.scroll.data-api', this.selector, process) this.refresh() @@ -111,11 +112,13 @@ /* SCROLLSPY DATA-API - * ============== */ + * ================== */ $(function () { - var $spy = $('[data-spy="scroll"]') - $spy.scrollspy($spy.data()) + $('[data-spy="scroll"]').each(function () { + var $spy = $(this) + $spy.scrollspy($spy.data()) + }) }) }( window.jQuery ) \ No newline at end of file From 5a54a98925f4f7375bdf63f86d21908b05af187e Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Tue, 24 Jan 2012 22:37:35 -0800 Subject: [PATCH 2/3] subnav spy scrolls blaawerh --- docs/base-css.html | 2 +- docs/components.html | 2 +- docs/javascript.html | 2 +- docs/less.html | 2 +- docs/scaffolding.html | 2 +- docs/upgrading.html | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/base-css.html b/docs/base-css.html index 27251d8244..08442cf3be 100644 --- a/docs/base-css.html +++ b/docs/base-css.html @@ -24,7 +24,7 @@ - + diff --git a/docs/components.html b/docs/components.html index d823998d95..ecdc9d27ac 100644 --- a/docs/components.html +++ b/docs/components.html @@ -24,7 +24,7 @@ - + diff --git a/docs/javascript.html b/docs/javascript.html index 8cf95c8153..222843af46 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -24,7 +24,7 @@ - + diff --git a/docs/less.html b/docs/less.html index 86a65a6c7e..c5fb46ca68 100644 --- a/docs/less.html +++ b/docs/less.html @@ -24,7 +24,7 @@ - + diff --git a/docs/scaffolding.html b/docs/scaffolding.html index bb18b03945..4f3fb9f221 100644 --- a/docs/scaffolding.html +++ b/docs/scaffolding.html @@ -24,7 +24,7 @@ - + diff --git a/docs/upgrading.html b/docs/upgrading.html index 7dab4c0000..1be32c676f 100644 --- a/docs/upgrading.html +++ b/docs/upgrading.html @@ -24,7 +24,7 @@ - + From 5d3175e84b2ada0978aca7dbbe2ec532e99c869a Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Tue, 24 Jan 2012 22:48:30 -0800 Subject: [PATCH 3/3] fix sub navs fer the otherrzz --- docs/base-css.html | 10 +++++----- docs/components.html | 18 +++++++++--------- docs/less.html | 8 ++++---- docs/scaffolding.html | 6 +++--- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/base-css.html b/docs/base-css.html index 08442cf3be..cddf769d4b 100644 --- a/docs/base-css.html +++ b/docs/base-css.html @@ -65,11 +65,11 @@

On top of the scaffolding, basic HTML elements are styled and enhanced with extensible classes to provide a fresh, consistent look and feel.

diff --git a/docs/components.html b/docs/components.html index ecdc9d27ac..65320f1cea 100644 --- a/docs/components.html +++ b/docs/components.html @@ -65,15 +65,15 @@

Dozens of reusable components are built into Bootstrap to provide navigation, alerts, popovers, and much more.

diff --git a/docs/less.html b/docs/less.html index c5fb46ca68..0ed8cdb66f 100644 --- a/docs/less.html +++ b/docs/less.html @@ -69,10 +69,10 @@

Customize and extend Bootstrap with LESS, a CSS preprocessor, to take advantage of the variables, mixins, and more used to build Bootstrap's CSS.

diff --git a/docs/scaffolding.html b/docs/scaffolding.html index 4f3fb9f221..91bd9b8d32 100644 --- a/docs/scaffolding.html +++ b/docs/scaffolding.html @@ -65,9 +65,9 @@

Bootstrap is built on a responsive 12-column grid. We've also included fixed- and fluid-width layouts based on that system.