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
57c8982b
Commit
57c8982b
authored
Jun 07, 2014
by
Chris Rebert
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mikegreiling-scrollspy-update'
parents
2ca65817
1cfa902e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
js/scrollspy.js
js/scrollspy.js
+17
-13
No files found.
js/scrollspy.js
View file @
57c8982b
...
...
@@ -14,20 +14,17 @@
// ==========================
function
ScrollSpy
(
element
,
options
)
{
var
href
var
process
=
$
.
proxy
(
this
.
process
,
this
)
this
.
$element
=
$
(
element
).
is
(
'
body
'
)
?
$
(
window
)
:
$
(
element
)
this
.
$body
=
$
(
'
body
'
)
this
.
$scrollElement
=
this
.
$element
.
on
(
'
scroll.bs.scrollspy
'
,
process
)
this
.
$scrollElement
=
$
(
element
).
is
(
'
body
'
)
?
$
(
window
)
:
$
(
element
)
this
.
options
=
$
.
extend
({},
ScrollSpy
.
DEFAULTS
,
options
)
this
.
selector
=
(
this
.
options
.
target
||
((
href
=
$
(
element
).
attr
(
'
href
'
))
&&
href
.
replace
(
/.*
(?=
#
[^\s]
+$
)
/
,
''
))
//strip for ie7
||
''
)
+
'
.nav li > a
'
this
.
offsets
=
$
([])
this
.
targets
=
$
([])
this
.
selector
=
(
this
.
options
.
target
||
''
)
+
'
.nav li > a
'
this
.
offsets
=
[]
this
.
targets
=
[]
this
.
activeTarget
=
null
this
.
$scrollElement
.
on
(
'
scroll.bs.scrollspy
'
,
process
)
this
.
refresh
()
this
.
process
()
}
...
...
@@ -39,10 +36,17 @@
}
ScrollSpy
.
prototype
.
refresh
=
function
()
{
var
offsetMethod
=
this
.
$element
[
0
]
==
window
?
'
offset
'
:
'
position
'
var
offsetMethod
=
'
offset
'
var
offsetBase
=
0
if
(
!
$
.
isWindow
(
this
.
$scrollElement
[
0
]))
{
offsetMethod
=
'
position
'
offsetBase
=
this
.
$scrollElement
.
scrollTop
()
}
this
.
offsets
=
[]
this
.
targets
=
[]
this
.
offsets
=
$
([])
this
.
targets
=
$
([])
var
self
=
this
this
.
$body
...
...
@@ -56,7 +60,7 @@
return
(
$href
&&
$href
.
length
&&
$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
]
})
.
each
(
function
()
{
...
...
@@ -75,7 +79,7 @@
var
i
if
(
scrollTop
>=
maxScroll
)
{
return
activeTarget
!=
(
i
=
targets
.
last
()[
0
])
&&
this
.
activate
(
i
)
return
activeTarget
!=
(
i
=
targets
[
targets
.
length
-
1
])
&&
this
.
activate
(
i
)
}
if
(
activeTarget
&&
scrollTop
<=
offsets
[
0
])
{
...
...
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