diff options
| author | Mark Otto <[email protected]> | 2012-01-24 23:36:39 -0800 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2012-01-24 23:36:39 -0800 |
| commit | e555f38ae4b1a2503b8bd3599894bb6011e0adbd (patch) | |
| tree | 1f74fdfa4472bfd71ae42f6af6b46bf3218ea847 | |
| parent | 6ab56051fdf916f03efb8aa6675e50bdd1cc3155 (diff) | |
| parent | 5d3175e84b2ada0978aca7dbbe2ec532e99c869a (diff) | |
| download | bootstrap-e555f38ae4b1a2503b8bd3599894bb6011e0adbd.tar.xz bootstrap-e555f38ae4b1a2503b8bd3599894bb6011e0adbd.zip | |
Merge branch '2.0-wip' of github.com:twitter/bootstrap into 2.0-wip
Conflicts:
docs/less.html
| -rw-r--r-- | docs/assets/js/application.js | 2 | ||||
| -rw-r--r-- | js/bootstrap-scrollspy.js | 15 |
2 files changed, 10 insertions, 7 deletions
diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index 0252d75e9..84227f555 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/js/bootstrap-scrollspy.js b/js/bootstrap-scrollspy.js index 5049bfdf9..91c49f32e 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 |
