Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bootstrap
Commits
e136ba0f
Commit
e136ba0f
authored
Jun 10, 2014
by
Mark Otto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13783 from twbs/fat-13220
fix #13220
parents
97e0cd01
571fd32b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
js/scrollspy.js
js/scrollspy.js
+11
-1
No files found.
js/scrollspy.js
View file @
e136ba0f
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
this
.
offsets
=
[]
this
.
offsets
=
[]
this
.
targets
=
[]
this
.
targets
=
[]
this
.
activeTarget
=
null
this
.
activeTarget
=
null
this
.
scrollHeight
=
0
this
.
$scrollElement
.
on
(
'
scroll.bs.scrollspy
'
,
process
)
this
.
$scrollElement
.
on
(
'
scroll.bs.scrollspy
'
,
process
)
this
.
refresh
()
this
.
refresh
()
...
@@ -39,6 +40,10 @@
...
@@ -39,6 +40,10 @@
offset
:
10
offset
:
10
}
}
ScrollSpy
.
prototype
.
getScrollHeight
=
function
()
{
return
this
.
$scrollElement
[
0
].
scrollHeight
||
Math
.
max
(
this
.
$body
[
0
].
scrollHeight
,
document
.
documentElement
.
scrollHeight
)
}
ScrollSpy
.
prototype
.
refresh
=
function
()
{
ScrollSpy
.
prototype
.
refresh
=
function
()
{
var
offsetMethod
=
'
offset
'
var
offsetMethod
=
'
offset
'
var
offsetBase
=
0
var
offsetBase
=
0
...
@@ -50,6 +55,7 @@
...
@@ -50,6 +55,7 @@
this
.
offsets
=
[]
this
.
offsets
=
[]
this
.
targets
=
[]
this
.
targets
=
[]
this
.
scrollHeight
=
this
.
getScrollHeight
()
var
self
=
this
var
self
=
this
...
@@ -74,13 +80,17 @@
...
@@ -74,13 +80,17 @@
ScrollSpy
.
prototype
.
process
=
function
()
{
ScrollSpy
.
prototype
.
process
=
function
()
{
var
scrollTop
=
this
.
$scrollElement
.
scrollTop
()
+
this
.
options
.
offset
var
scrollTop
=
this
.
$scrollElement
.
scrollTop
()
+
this
.
options
.
offset
var
scrollHeight
=
this
.
$scrollElement
[
0
].
scrollHeight
||
Math
.
max
(
this
.
$body
[
0
].
scrollHeight
,
document
.
documentElement
.
scrollHeight
)
var
scrollHeight
=
this
.
getScrollHeight
(
)
var
maxScroll
=
this
.
options
.
offset
+
scrollHeight
-
this
.
$scrollElement
.
height
()
var
maxScroll
=
this
.
options
.
offset
+
scrollHeight
-
this
.
$scrollElement
.
height
()
var
offsets
=
this
.
offsets
var
offsets
=
this
.
offsets
var
targets
=
this
.
targets
var
targets
=
this
.
targets
var
activeTarget
=
this
.
activeTarget
var
activeTarget
=
this
.
activeTarget
var
i
var
i
if
(
this
.
scrollHeight
!=
scrollHeight
)
{
this
.
refresh
()
}
if
(
scrollTop
>=
maxScroll
)
{
if
(
scrollTop
>=
maxScroll
)
{
return
activeTarget
!=
(
i
=
targets
[
targets
.
length
-
1
])
&&
this
.
activate
(
i
)
return
activeTarget
!=
(
i
=
targets
[
targets
.
length
-
1
])
&&
this
.
activate
(
i
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment