Merge pull request #17 from Tarabass/gh-pages

IE - Fixed scrolling issue with navbar when scrolling up.
This commit is contained in:
David Miller
2016-02-08 14:23:23 -05:00
3 changed files with 29 additions and 28 deletions

3
.gitignore vendored
View File

@@ -1 +1,2 @@
node_modules node_modules
*.idea

View File

@@ -1003,30 +1003,30 @@ $(function() {
// Navigation Scripts to Show Header on Scroll-Up // Navigation Scripts to Show Header on Scroll-Up
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
var MQL = 1170; var MQL = 1170;
//primary navigation slide-in effect //primary navigation slide-in effect
if ($(window).width() > MQL) { if ($(window).width() > MQL) {
var headerHeight = $('.navbar-custom').height(); var headerHeight = $('.navbar-custom').height();
$(window).on('scroll', { $(window).on('scroll', {
previousTop: 0 previousTop: 0
}, },
function() { function() {
var currentTop = $(window).scrollTop(); var currentTop = $(window).scrollTop();
//check if user is scrolling up //check if user is scrolling up
if (currentTop < this.previousTop) { if (currentTop < this.previousTop) {
//if scrolling up... //if scrolling up...
if (currentTop > 0 && $('.navbar-custom').hasClass('is-fixed')) { if (currentTop > 0 && $('.navbar-custom').hasClass('is-fixed')) {
$('.navbar-custom').addClass('is-visible'); $('.navbar-custom').addClass('is-visible');
} else { } else {
$('.navbar-custom').removeClass('is-visible is-fixed'); $('.navbar-custom').removeClass('is-visible is-fixed');
} }
} else { } else if (currentTop > this.previousTop) {
//if scrolling down... //if scrolling down...
$('.navbar-custom').removeClass('is-visible'); $('.navbar-custom').removeClass('is-visible');
if (currentTop > headerHeight && !$('.navbar-custom').hasClass('is-fixed')) $('.navbar-custom').addClass('is-fixed'); if (currentTop > headerHeight && !$('.navbar-custom').hasClass('is-fixed')) $('.navbar-custom').addClass('is-fixed');
} }
this.previousTop = currentTop; this.previousTop = currentTop;
}); });
} }
}); });

File diff suppressed because one or more lines are too long