function menu_scroll() {
var new_scroll_value = $(window).scrollTop() >= 0 ? $(window).scrollTop() : 0;
var local_diff = new_scroll_value - prev_scroll_value;
var current = parseInt($(page_nav).css('top'));
var h = header.outerHeight() < 150 ? 150 : header.outerHeight();
if(new_scroll_value >= h) {
if(
!$(page_nav).hasClass('gk-fixed-nav')
) {
$(page_nav).addClass('gk-fixed-nav');
$(page_nav).css('top', '-150px');
current = -150;
}
if(new_scroll_value >= prev_scroll_value) {
$(page_nav).css('top', (current - local_diff >= -150 ? current - local_diff : -150) + "px");
} else {
if($('body').hasClass('admin-bar')) {
$(page_nav).css('top', (current - local_diff <= -20 ? current - local_diff : -20) + "px");
} else {
$(page_nav).css('top', (current - local_diff <= -45 ? current - local_diff : -45) + "px");
}
}
} else {
if($(page_nav).hasClass('gk-fixed-nav')) {
$(page_nav).removeClass('gk-fixed-nav');
$(page_nav).css('top', 0);
}
}
prev_scroll_value = new_scroll_value;
}
function menu_scroll() {
var new_scroll_value = $(window).scrollTop() >= 0 ? $(window).scrollTop() : 0;
var local_diff = new_scroll_value - prev_scroll_value;
var current = parseInt($(page_nav).css('top'));
var h = header.outerHeight() < 150 ? 150 : header.outerHeight();
if(new_scroll_value >= h) {
if(
!$(page_nav).hasClass('gk-fixed-nav')
) {
$(page_nav).addClass('gk-fixed-nav');
$(page_nav).css('top', '-20px');
}
} else {
if($(page_nav).hasClass('gk-fixed-nav')) {
$(page_nav).removeClass('gk-fixed-nav');
$(page_nav).css('top', 0);
}
}
prev_scroll_value = new_scroll_value;
}
function menu_scroll() {
var new_scroll_value = $(window).scrollTop() >= 0 ? $(window).scrollTop() : 0;
var local_diff = new_scroll_value - prev_scroll_value;
var current = parseInt($(page_nav).css('top'));
var h = header.outerHeight() < 150 ? 150 : header.outerHeight();
if(new_scroll_value >= h) {
if(
!$(page_nav).hasClass('gk-fixed-nav')
) {
$(page_nav).addClass('gk-fixed-nav');
$(page_nav).css('top', '-150px');
current = -150;
// Logo switching
if(image_logo_exists && dark_logo_img) {
logo_img.attr('src', dark_logo_img);
}
}
if(new_scroll_value >= prev_scroll_value) {
$(page_nav).css('top', (current - local_diff >= -150 ? current - local_diff : -150) + "px");
} else {
if($('body').hasClass('admin-bar')) {
$(page_nav).css('top', (current - local_diff <= -20 ? current - local_diff : -20) + "px");
} else {
$(page_nav).css('top', (current - local_diff <= -45 ? current - local_diff : -45) + "px");
}
}
} else {
if($(page_nav).hasClass('gk-fixed-nav')) {
$(page_nav).removeClass('gk-fixed-nav');
$(page_nav).css('top', 0);
// Logo switching
if(image_logo_exists) {
if(dark_logo_img && dark_bg_class) {
logo_img.attr('src', dark_logo_img);
} else {
logo_img.attr('src', light_logo_img);
}
}
}
}
prev_scroll_value = new_scroll_value;
}
$(window).scroll(menu_scroll);
function menu_scroll() {
var new_scroll_value = $(window).scrollTop() >= 0 ? $(window).scrollTop() : 0;
var local_diff = new_scroll_value - prev_scroll_value;
var current = parseInt($(page_nav).css('top'));
if(
!$(page_nav).hasClass('gk-fixed-nav')
) {
$(page_nav).addClass('gk-fixed-nav');
$(page_nav).css('top', '-20px');
}
prev_scroll_value = new_scroll_value;
}
$(document).ready(menu_scroll);