Skip to content

Commit

Permalink
Create Headroom only when header exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Gatsik authored and Brutus5000 committed Oct 25, 2021
1 parent e44bf47 commit 4e6ef46
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions public/js/app/navigation.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
var headroom = new Headroom(document.querySelector('.navigation-wrapper'), {
'offset': 100,
'tolerance': 5,
'classes': {
'initial': '',
'pinned': 'pinned',
'unpinned': 'unpinned',
'top': 'at-top',
'notTop': 'not-at-top',
'bottom': 'at-bottom',
'notBottom': 'not-at-bottom'
}
});

headroom.init();
if (document.querySelector('.navigation-wrapper') !== null) {
var headroom = new Headroom(document.querySelector('.navigation-wrapper'), {
'offset': 100,
'tolerance': 5,
'classes': {
'initial': '',
'pinned': 'pinned',
'unpinned': 'unpinned',
'top': 'at-top',
'notTop': 'not-at-top',
'bottom': 'at-bottom',
'notBottom': 'not-at-bottom'
}
});

headroom.init();
}

$(document).ready(function() {
$('.toggle-nav').click(function() {
if ($('.navigation-wrapper').hasClass('opened')) {
Expand Down

0 comments on commit 4e6ef46

Please sign in to comment.