Skip to content

Commit

Permalink
feat(Navigation): Maintain selection in nav.
Browse files Browse the repository at this point in the history
Maintain the selection in the left nav when the page changes.
  • Loading branch information
kendrick committed Nov 1, 2016
1 parent 1a718b2 commit 8844971
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions templates/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
$('li.isActive', '#docs-leftnav').removeClass('isActive');
$('#docs-leftnav').find('li[ref="' + pageTitle + '"]').addClass('isActive');

// Mobile heuristic. 48rem == 'md' breakpoint.
if (!window.matchMedia('(min-width: 48rem)') {
$('.isActive').parent().siblings('.category-toggle').prop('checked', true);
}

$('.nav .category-label').click(function (e) {
// Mobile heuristic. 48rem == 'md' breakpoint.
if (!window.matchMedia('(min-width: 48rem)').matches && $(this).siblings('.category-toggle').prop('checked') === false) {
Expand Down
5 changes: 5 additions & 0 deletions templates/scss/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ body { min-height: 100%; }
a {
text-decoration: none;
}

.isActive {
background: color(white);
font-weight: font-weight(semibold);
}
}

#docs-content {
Expand Down

0 comments on commit 8844971

Please sign in to comment.