mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-06 04:08:22 +01:00
select last item in scrollspy if you've reached the bottom of the document or element
This commit is contained in:
parent
527fb87dad
commit
5a2c7eb50a
Binary file not shown.
7
docs/assets/js/bootstrap-scrollspy.js
vendored
7
docs/assets/js/bootstrap-scrollspy.js
vendored
@ -57,11 +57,18 @@
|
|||||||
|
|
||||||
, process: function () {
|
, process: function () {
|
||||||
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
|
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
|
||||||
|
, scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
|
||||||
|
, maxScroll = scrollHeight - this.$scrollElement.height()
|
||||||
, offsets = this.offsets
|
, offsets = this.offsets
|
||||||
, targets = this.targets
|
, targets = this.targets
|
||||||
, activeTarget = this.activeTarget
|
, activeTarget = this.activeTarget
|
||||||
, i
|
, i
|
||||||
|
|
||||||
|
if (scrollTop >= maxScroll) {
|
||||||
|
return activeTarget != (i = targets.last()[0])
|
||||||
|
&& this.activate ( i );
|
||||||
|
}
|
||||||
|
|
||||||
for (i = offsets.length; i--;) {
|
for (i = offsets.length; i--;) {
|
||||||
activeTarget != targets[i]
|
activeTarget != targets[i]
|
||||||
&& scrollTop >= offsets[i]
|
&& scrollTop >= offsets[i]
|
||||||
|
7
js/bootstrap-scrollspy.js
vendored
7
js/bootstrap-scrollspy.js
vendored
@ -57,11 +57,18 @@
|
|||||||
|
|
||||||
, process: function () {
|
, process: function () {
|
||||||
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
|
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
|
||||||
|
, scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
|
||||||
|
, maxScroll = scrollHeight - this.$scrollElement.height()
|
||||||
, offsets = this.offsets
|
, offsets = this.offsets
|
||||||
, targets = this.targets
|
, targets = this.targets
|
||||||
, activeTarget = this.activeTarget
|
, activeTarget = this.activeTarget
|
||||||
, i
|
, i
|
||||||
|
|
||||||
|
if (scrollTop >= maxScroll) {
|
||||||
|
return activeTarget != (i = targets.last()[0])
|
||||||
|
&& this.activate ( i );
|
||||||
|
}
|
||||||
|
|
||||||
for (i = offsets.length; i--;) {
|
for (i = offsets.length; i--;) {
|
||||||
activeTarget != targets[i]
|
activeTarget != targets[i]
|
||||||
&& scrollTop >= offsets[i]
|
&& scrollTop >= offsets[i]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user