Skip to content

Commit

Permalink
fix(component): scrollspy
Browse files Browse the repository at this point in the history
doc nav pills not supported
js for mobile
  • Loading branch information
ygatesoupe authored and Lausselloic committed Jan 12, 2017
1 parent 9a0bf37 commit 9a62985
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions docs/components/scrollspy.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ group: components
The ScrollSpy plugin is for automatically updating nav targets based on scroll position. Scroll the area below the navbar and watch the active class change. The dropdown sub items will be highlighted as well.

<div class="bd-example">
<nav id="navbar-example2" class="navbar navbar-light bg-faded">
<!--- boosted mod nav-pills not supported -->
<nav id="navbar-example2" class="navbar navbar-light bg-faded navbar-toggleable">
<a class="navbar-brand" href="#">Navbar</a>
<ul class="nav nav-pills">
<ul class="nav navbar-nav">
<li class="nav-item"><a class="nav-link" href="#fat">@fat</a></li>
<li class="nav-item"><a class="nav-link" href="#mdo">@mdo</a></li>
<li class="nav-item dropdown">
Expand All @@ -31,6 +32,7 @@ The ScrollSpy plugin is for automatically updating nav targets based on scroll p
</li>
</ul>
</nav>
<!--- end mod -->
<div data-spy="scroll" data-target="#navbar-example2" data-offset="0" 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.</p>
Expand Down
8 changes: 4 additions & 4 deletions js/src/collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,22 +386,22 @@ const Collapse = (($) => {

$(() => {
// local navigation
$('.o-nav-local .nav-inline.collapse .nav-link').on('click', (event) => {
$('.o-nav-local .nav.collapse .nav-link').on('click', (event) => {
$(event.currentTarget).parent().parent().prev('.local-select').text($(event.currentTarget).text())
})

$('.o-nav-local .nav-inline.collapse').on('shown.bs.collapse', (event) => {
$('.o-nav-local .nav.collapse').on('shown.bs.collapse', (event) => {
$(event.currentTarget).find('.nav-item:first-child .nav-link').trigger('focus')
})

$(document).ready(() => {
$('.o-nav-local .local-select').each(function () {
$(this).text($(this).next('.nav-inline.collapse').find('.nav-item:first-child .nav-link').text())
$(this).text($(this).next('.nav.collapse').find('.nav-item:first-child .nav-link').text())
})
})

$(document).on('click', () => {
Collapse._jQueryInterface.call($('.o-nav-local .collapse.in'), 'hide')
Collapse._jQueryInterface.call($('.o-nav-local .collapse.show'), 'hide')
})
})

Expand Down

0 comments on commit 9a62985

Please sign in to comment.