Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJacob Thornton <jacobthornton@gmail.com>2012-01-25 10:33:33 +0400
committerJacob Thornton <jacobthornton@gmail.com>2012-01-25 10:33:33 +0400
commit5e5e87fbd0f577256d8a2b479bb9ed2187ff7f91 (patch)
tree6b8ad5b9f7af6303a6316c41747eed32d2050311 /js
parentf2fe2b1798380ab65e88281ab4db47965cd5aaf8 (diff)
scrollspy working for sub navs
Diffstat (limited to 'js')
-rw-r--r--js/bootstrap-scrollspy.js15
1 files changed, 9 insertions, 6 deletions
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