mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-19 16:54:24 +01:00
allow scrollspy to target a specific nav
This commit is contained in:
parent
98fddaa355
commit
bd8745a98b
@ -380,7 +380,7 @@ $('#myModal').bind('hidden', function () {
|
||||
Scroll the area below and watch the navigation update. The dropdown sub items will be highlighted as well. Try it!</p>
|
||||
<p>
|
||||
|
||||
<div id="navbar-example" class="navbar navbar-static">
|
||||
<div id="navbarExample" class="navbar navbar-static">
|
||||
<div class="navbar-inner">
|
||||
<div class="container" style="width: auto;">
|
||||
<a class="brand" href="#">Project Name</a>
|
||||
@ -401,7 +401,7 @@ $('#myModal').bind('hidden', function () {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-spy="scroll" class="scrollspy-example">
|
||||
<div data-spy="scroll" data-target="#navbarExample" class="scrollspy-example">
|
||||
<h4 id="fat">@fat</h4>
|
||||
<p>
|
||||
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
|
||||
|
4
js/bootstrap-scrollspy.js
vendored
4
js/bootstrap-scrollspy.js
vendored
@ -26,10 +26,10 @@
|
||||
|
||||
function ScrollSpy( element ) {
|
||||
var process = $.proxy(this.process, this)
|
||||
this.selector = '.nav li > a'
|
||||
|
||||
this.$body = $('body').delegate(this.selector, 'click.scroll.data-api', process)
|
||||
this.$scrollElement = $(element).bind('scroll.scroll.data-api', process)
|
||||
this.selector = (this.$scrollElement.attr('data-target') || '') + ' .nav li > a'
|
||||
this.$body = $('body').delegate(this.selector, 'click.scroll.data-api', process)
|
||||
|
||||
this.refresh()
|
||||
this.process()
|
||||
|
Loading…
x
Reference in New Issue
Block a user