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
5e5e87fb
Commit
5e5e87fb
authored
Jan 24, 2012
by
Jacob Thornton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scrollspy working for sub navs
parent
f2fe2b17
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
20 deletions
+23
-20
docs/assets/js/application.js
docs/assets/js/application.js
+1
-1
docs/javascript.html
docs/javascript.html
+13
-13
js/bootstrap-scrollspy.js
js/bootstrap-scrollspy.js
+9
-6
No files found.
docs/assets/js/application.js
View file @
5e5e87fb
...
...
@@ -119,7 +119,7 @@ $(function(){
// fix sub nav playa
var
$win
=
$
(
window
)
,
$nav
=
$
(
'
.subnav
'
)
,
navTop
=
$
(
'
.subnav
'
).
offset
().
top
-
40
,
navTop
=
$
(
'
.subnav
'
).
length
&&
$
(
'
.subnav
'
).
offset
().
top
-
40
,
isFixed
=
0
processScroll
()
...
...
docs/javascript.html
View file @
5e5e87fb
...
...
@@ -24,7 +24,7 @@
<link
rel=
"apple-touch-icon"
sizes=
"114x114"
href=
"images/apple-touch-icon-114x114.png"
>
</head>
<body>
<body
data-spy=
"scroll"
data-target=
".subnav"
data-offset=
"0"
>
<!-- Navbar
================================================== -->
...
...
@@ -65,18 +65,18 @@
<p
class=
"lead"
>
Bring Bootstrap's components to life
—
now with 12 custom
<a
href=
"http://jquery.com/"
target=
"_blank"
>
jQuery
</a>
plugins.
<div
class=
"subnav"
>
<ul
class=
"nav pills"
>
<li
><a
href=
"./javascript.html
#javascript"
>
Overview
</a></li>
<li><a
href=
"
./javascript.html
#modals"
>
Modal
</a></li>
<li><a
href=
"
./javascript.html
#dropdowns"
>
Dropdown
</a></li>
<li><a
href=
"
./javascript.html
#scrollspy"
>
Scrollspy
</a></li>
<li><a
href=
"
./javascript.html
#tabs"
>
Tab
</a></li>
<li><a
href=
"
./javascript.html
#tooltips"
>
Tooltip
</a></li>
<li><a
href=
"
./javascript.html
#popovers"
>
Popover
</a></li>
<li><a
href=
"
./javascript.html
#alerts"
>
Alert
</a></li>
<li><a
href=
"
./javascript.html
#buttons"
>
Button
</a></li>
<li><a
href=
"
./javascript.html
#collapse"
>
Collapse
</a></li>
<li><a
href=
"
./javascript.html
#carousel"
>
Carousel
</a></li>
<li><a
href=
"
./javascript.html
#typeahead"
>
Typeahead
</a></li>
<li
class=
"active"
><a
href=
"
#javascript"
>
Overview
</a></li>
<li><a
href=
"#modals"
>
Modal
</a></li>
<li><a
href=
"#dropdowns"
>
Dropdown
</a></li>
<li><a
href=
"#scrollspy"
>
Scrollspy
</a></li>
<li><a
href=
"#tabs"
>
Tab
</a></li>
<li><a
href=
"#tooltips"
>
Tooltip
</a></li>
<li><a
href=
"#popovers"
>
Popover
</a></li>
<li><a
href=
"#alerts"
>
Alert
</a></li>
<li><a
href=
"#buttons"
>
Button
</a></li>
<li><a
href=
"#collapse"
>
Collapse
</a></li>
<li><a
href=
"#carousel"
>
Carousel
</a></li>
<li><a
href=
"#typeahead"
>
Typeahead
</a></li>
</ul>
</div>
</header>
...
...
js/bootstrap-scrollspy.js
View file @
5e5e87fb
...
...
@@ -26,10 +26,11 @@
function
ScrollSpy
(
element
,
options
)
{
var
process
=
$
.
proxy
(
this
.
process
,
this
)
,
$element
=
$
(
element
).
is
(
'
body
'
)
?
$
(
window
)
:
$
(
element
)
this
.
options
=
$
.
extend
({},
$
.
fn
.
scrollspy
.
defaults
,
options
)
this
.
$scrollElement
=
$
(
element
)
.
on
(
'
scroll.scroll.data-api
'
,
process
)
this
.
selector
=
(
this
.
$scrollElement
.
attr
(
'
data-target
'
)
||
this
.
$scrollElement
.
attr
(
'
href
'
)
this
.
$scrollElement
=
$
element
.
on
(
'
scroll.scroll.data-api
'
,
process
)
this
.
selector
=
(
this
.
options
.
target
||
$
(
element
)
.
attr
(
'
href
'
)
||
''
)
+
'
.nav li > a
'
this
.
$body
=
$
(
'
body
'
).
on
(
'
click.scroll.data-api
'
,
this
.
selector
,
process
)
this
.
refresh
()
...
...
@@ -111,11 +112,13 @@
/* SCROLLSPY DATA-API
* ============== */
* ==============
====
*/
$
(
function
()
{
var
$spy
=
$
(
'
[data-spy="scroll"]
'
)
$
(
'
[data-spy="scroll"]
'
).
each
(
function
()
{
var
$spy
=
$
(
this
)
$spy
.
scrollspy
(
$spy
.
data
())
})
})
}(
window
.
jQuery
)
\ No newline at end of file
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