Skip to content
GitLab
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
cfa4ab90
Commit
cfa4ab90
authored
11 years ago
by
fat
Browse files
Options
Download
Email Patches
Plain Diff
fix scrollspy for window *and* children
parent
2cf1851d
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dist/js/bootstrap.js
+5
-3
dist/js/bootstrap.js
dist/js/bootstrap.min.js
+1
-1
dist/js/bootstrap.min.js
js/scrollspy.js
+5
-3
js/scrollspy.js
with
11 additions
and
7 deletions
+11
-7
dist/js/bootstrap.js
+
5
-
3
View file @
cfa4ab90
...
...
@@ -1569,10 +1569,10 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
function
ScrollSpy
(
element
,
options
)
{
var
href
var
process
=
$
.
proxy
(
this
.
process
,
this
)
var
$element
=
$
(
element
).
is
(
'
body
'
)
?
$
(
window
)
:
$
(
element
)
this
.
$element
=
$
(
element
).
is
(
'
body
'
)
?
$
(
window
)
:
$
(
element
)
this
.
$body
=
$
(
'
body
'
)
this
.
$scrollElement
=
$element
.
on
(
'
scroll.bs.scroll-spy.data-api
'
,
process
)
this
.
$scrollElement
=
this
.
$element
.
on
(
'
scroll.bs.scroll-spy.data-api
'
,
process
)
this
.
options
=
$
.
extend
({},
ScrollSpy
.
DEFAULTS
,
options
)
this
.
selector
=
(
this
.
options
.
target
||
((
href
=
$
(
element
).
attr
(
'
href
'
))
&&
href
.
replace
(
/.*
(?=
#
[^\s]
+$
)
/
,
''
))
//strip for ie7
...
...
@@ -1590,6 +1590,8 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
}
ScrollSpy
.
prototype
.
refresh
=
function
()
{
var
offsetMethod
=
this
.
$element
[
0
]
==
window
?
'
offset
'
:
'
position
'
this
.
offsets
=
$
([])
this
.
targets
=
$
([])
...
...
@@ -1603,7 +1605,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
return
(
$href
&&
$href
.
length
&&
[[
$href
.
offset
().
top
+
(
!
$
.
isWindow
(
self
.
$scrollElement
.
get
(
0
))
&&
self
.
$scrollElement
.
scrollTop
()),
href
]])
||
null
&&
[[
$href
[
offset
Method
]
().
top
+
(
!
$
.
isWindow
(
self
.
$scrollElement
.
get
(
0
))
&&
self
.
$scrollElement
.
scrollTop
()),
href
]])
||
null
})
.
sort
(
function
(
a
,
b
)
{
return
a
[
0
]
-
b
[
0
]
})
.
each
(
function
()
{
...
...
This diff is collapsed.
Click to expand it.
dist/js/bootstrap.min.js
+
1
-
1
View file @
cfa4ab90
This diff is collapsed.
Click to expand it.
js/scrollspy.js
+
5
-
3
View file @
cfa4ab90
...
...
@@ -26,10 +26,10 @@
function
ScrollSpy
(
element
,
options
)
{
var
href
var
process
=
$
.
proxy
(
this
.
process
,
this
)
var
$element
=
$
(
element
).
is
(
'
body
'
)
?
$
(
window
)
:
$
(
element
)
this
.
$element
=
$
(
element
).
is
(
'
body
'
)
?
$
(
window
)
:
$
(
element
)
this
.
$body
=
$
(
'
body
'
)
this
.
$scrollElement
=
$element
.
on
(
'
scroll.bs.scroll-spy.data-api
'
,
process
)
this
.
$scrollElement
=
this
.
$element
.
on
(
'
scroll.bs.scroll-spy.data-api
'
,
process
)
this
.
options
=
$
.
extend
({},
ScrollSpy
.
DEFAULTS
,
options
)
this
.
selector
=
(
this
.
options
.
target
||
((
href
=
$
(
element
).
attr
(
'
href
'
))
&&
href
.
replace
(
/.*
(?=
#
[^\s]
+$
)
/
,
''
))
//strip for ie7
...
...
@@ -47,6 +47,8 @@
}
ScrollSpy
.
prototype
.
refresh
=
function
()
{
var
offsetMethod
=
this
.
$element
[
0
]
==
window
?
'
offset
'
:
'
position
'
this
.
offsets
=
$
([])
this
.
targets
=
$
([])
...
...
@@ -60,7 +62,7 @@
return
(
$href
&&
$href
.
length
&&
[[
$href
.
offset
().
top
+
(
!
$
.
isWindow
(
self
.
$scrollElement
.
get
(
0
))
&&
self
.
$scrollElement
.
scrollTop
()),
href
]])
||
null
&&
[[
$href
[
offset
Method
]
().
top
+
(
!
$
.
isWindow
(
self
.
$scrollElement
.
get
(
0
))
&&
self
.
$scrollElement
.
scrollTop
()),
href
]])
||
null
})
.
sort
(
function
(
a
,
b
)
{
return
a
[
0
]
-
b
[
0
]
})
.
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