Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
1cfa902e
Commit
1cfa902e
authored
10 years ago
by
Mike Greiling
Committed by
Chris Rebert
10 years ago
Browse files
Options
Download
Email Patches
Plain Diff
refactor scrollspy refresh method
Closes #13702 by merging a rebased version of it.
parent
bc8e6ffb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/scrollspy.js
+8
-2
js/scrollspy.js
with
8 additions
and
2 deletions
+8
-2
js/scrollspy.js
+
8
-
2
View file @
1cfa902e
...
@@ -36,7 +36,13 @@
...
@@ -36,7 +36,13 @@
}
}
ScrollSpy
.
prototype
.
refresh
=
function
()
{
ScrollSpy
.
prototype
.
refresh
=
function
()
{
var
offsetMethod
=
this
.
$scrollElement
[
0
]
==
window
?
'
offset
'
:
'
position
'
var
offsetMethod
=
'
offset
'
var
offsetBase
=
0
if
(
!
$
.
isWindow
(
this
.
$scrollElement
[
0
]))
{
offsetMethod
=
'
position
'
offsetBase
=
this
.
$scrollElement
.
scrollTop
()
}
this
.
offsets
=
[]
this
.
offsets
=
[]
this
.
targets
=
[]
this
.
targets
=
[]
...
@@ -54,7 +60,7 @@
...
@@ -54,7 +60,7 @@
return
(
$href
return
(
$href
&&
$href
.
length
&&
$href
.
length
&&
$href
.
is
(
'
:visible
'
)
&&
$href
.
is
(
'
:visible
'
)
&&
[[
$href
[
offsetMethod
]().
top
+
(
!
$
.
isWindow
(
self
.
$scrollElement
.
get
(
0
))
&&
self
.
$scrollElement
.
scrollTop
())
,
href
]])
||
null
&&
[[
$href
[
offsetMethod
]().
top
+
offsetBase
,
href
]])
||
null
})
})
.
sort
(
function
(
a
,
b
)
{
return
a
[
0
]
-
b
[
0
]
})
.
sort
(
function
(
a
,
b
)
{
return
a
[
0
]
-
b
[
0
]
})
.
each
(
function
()
{
.
each
(
function
()
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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
Menu
Explore
Projects
Groups
Snippets