IE - Fixed scrolling issue with navbar when scrolling up.

This commit is contained in:
Tarabass
2016-02-07 20:00:58 +01:00
parent 34c689ff17
commit 32ddfce52e
2 changed files with 27 additions and 27 deletions

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