mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-13 17:14:04 +02:00
allow for pushstate in scrollspy
This commit is contained in:
10
docs/assets/js/bootstrap-scrollspy.js
vendored
10
docs/assets/js/bootstrap-scrollspy.js
vendored
@@ -54,7 +54,8 @@
|
|||||||
$targets = this.$body
|
$targets = this.$body
|
||||||
.find(this.selector)
|
.find(this.selector)
|
||||||
.map(function () {
|
.map(function () {
|
||||||
var href = $(this).attr('href')
|
var $el = $(this)
|
||||||
|
, href = $el.data('target') || $el.attr('href')
|
||||||
, $href = /^#\w/.test(href) && $(href)
|
, $href = /^#\w/.test(href) && $(href)
|
||||||
return ( $href
|
return ( $href
|
||||||
&& href.length
|
&& href.length
|
||||||
@@ -91,6 +92,7 @@
|
|||||||
|
|
||||||
, activate: function (target) {
|
, activate: function (target) {
|
||||||
var active
|
var active
|
||||||
|
, selector
|
||||||
|
|
||||||
this.activeTarget = target
|
this.activeTarget = target
|
||||||
|
|
||||||
@@ -98,7 +100,11 @@
|
|||||||
.parent('.active')
|
.parent('.active')
|
||||||
.removeClass('active')
|
.removeClass('active')
|
||||||
|
|
||||||
active = $(this.selector + '[href="' + target + '"]')
|
selector = this.selector
|
||||||
|
+ '[data-target="' + target + '"],'
|
||||||
|
+ this.selector + '[href="' + target + '"]'
|
||||||
|
|
||||||
|
active = $(selector)
|
||||||
.parent('li')
|
.parent('li')
|
||||||
.addClass('active')
|
.addClass('active')
|
||||||
|
|
||||||
|
10
docs/assets/js/bootstrap.js
vendored
10
docs/assets/js/bootstrap.js
vendored
@@ -1309,7 +1309,8 @@
|
|||||||
$targets = this.$body
|
$targets = this.$body
|
||||||
.find(this.selector)
|
.find(this.selector)
|
||||||
.map(function () {
|
.map(function () {
|
||||||
var href = $(this).attr('href')
|
var $el = $(this)
|
||||||
|
, href = $el.data('target') || $el.attr('href')
|
||||||
, $href = /^#\w/.test(href) && $(href)
|
, $href = /^#\w/.test(href) && $(href)
|
||||||
return ( $href
|
return ( $href
|
||||||
&& href.length
|
&& href.length
|
||||||
@@ -1346,6 +1347,7 @@
|
|||||||
|
|
||||||
, activate: function (target) {
|
, activate: function (target) {
|
||||||
var active
|
var active
|
||||||
|
, selector
|
||||||
|
|
||||||
this.activeTarget = target
|
this.activeTarget = target
|
||||||
|
|
||||||
@@ -1353,7 +1355,11 @@
|
|||||||
.parent('.active')
|
.parent('.active')
|
||||||
.removeClass('active')
|
.removeClass('active')
|
||||||
|
|
||||||
active = $(this.selector + '[href="' + target + '"]')
|
selector = this.selector
|
||||||
|
+ '[data-target="' + target + '"],'
|
||||||
|
+ this.selector + '[href="' + target + '"]'
|
||||||
|
|
||||||
|
active = $(selector)
|
||||||
.parent('li')
|
.parent('li')
|
||||||
.addClass('active')
|
.addClass('active')
|
||||||
|
|
||||||
|
2
docs/assets/js/bootstrap.min.js
vendored
2
docs/assets/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
10
js/bootstrap-scrollspy.js
vendored
10
js/bootstrap-scrollspy.js
vendored
@@ -54,7 +54,8 @@
|
|||||||
$targets = this.$body
|
$targets = this.$body
|
||||||
.find(this.selector)
|
.find(this.selector)
|
||||||
.map(function () {
|
.map(function () {
|
||||||
var href = $(this).attr('href')
|
var $el = $(this)
|
||||||
|
, href = $el.data('target') || $el.attr('href')
|
||||||
, $href = /^#\w/.test(href) && $(href)
|
, $href = /^#\w/.test(href) && $(href)
|
||||||
return ( $href
|
return ( $href
|
||||||
&& href.length
|
&& href.length
|
||||||
@@ -91,6 +92,7 @@
|
|||||||
|
|
||||||
, activate: function (target) {
|
, activate: function (target) {
|
||||||
var active
|
var active
|
||||||
|
, selector
|
||||||
|
|
||||||
this.activeTarget = target
|
this.activeTarget = target
|
||||||
|
|
||||||
@@ -98,7 +100,11 @@
|
|||||||
.parent('.active')
|
.parent('.active')
|
||||||
.removeClass('active')
|
.removeClass('active')
|
||||||
|
|
||||||
active = $(this.selector + '[href="' + target + '"]')
|
selector = this.selector
|
||||||
|
+ '[data-target="' + target + '"],'
|
||||||
|
+ this.selector + '[href="' + target + '"]'
|
||||||
|
|
||||||
|
active = $(selector)
|
||||||
.parent('li')
|
.parent('li')
|
||||||
.addClass('active')
|
.addClass('active')
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user