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-04-19 00:35:14 +0400
committerJacob Thornton <jacobthornton@gmail.com>2012-04-19 00:35:14 +0400
commitbc07e2adae7bc61795d54681915d791aee41c49a (patch)
tree548742b36162ed9a251d02963ef628125f80508e /js
parentb627898919bcd17cafe5b1cae69c555ebb9a769e (diff)
allow for pushstate in scrollspy
Diffstat (limited to 'js')
-rw-r--r--js/bootstrap-scrollspy.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/js/bootstrap-scrollspy.js b/js/bootstrap-scrollspy.js
index c67f1c8aa8..5c19ae382a 100644
--- a/js/bootstrap-scrollspy.js
+++ b/js/bootstrap-scrollspy.js
@@ -54,7 +54,8 @@
$targets = this.$body
.find(this.selector)
.map(function () {
- var href = $(this).attr('href')
+ var $el = $(this)
+ , href = $el.data('target') || $el.attr('href')
, $href = /^#\w/.test(href) && $(href)
return ( $href
&& href.length
@@ -91,6 +92,7 @@
, activate: function (target) {
var active
+ , selector
this.activeTarget = target
@@ -98,7 +100,11 @@
.parent('.active')
.removeClass('active')
- active = $(this.selector + '[href="' + target + '"]')
+ selector = this.selector
+ + '[data-target="' + target + '"],'
+ + this.selector + '[href="' + target + '"]'
+
+ active = $(selector)
.parent('li')
.addClass('active')