bishawjit-das
10/22/2015 - 6:09 PM

Wordpress logged in Wp admin bar menu fix

Wordpress logged in Wp admin bar menu fix

function wp_logged_in_menu_fix() {

	if ( $('body').hasClass('logged-in') ) {
		var w = $(window).width();
		if ( w < 600 ) {
			$('.navbar-fixed-top').css({'top': '46px', 'position': 'absolute'});
			$(window).scroll(function () {
				var s = $(this).scrollTop();
				if ( s > 46 ) {
					$('.navbar-fixed-top').css({'top': '0', 'position': 'fixed'});
				} else {
					$('.navbar-fixed-top').css({'top': '46px', 'position': 'absolute'});
				}
			});
		} else if ( w > 600 && w < 766 ) {
			$('.navbar-fixed-top').css({'top': '46px', 'position': 'fixed'});
		} else {
			$('.navbar-fixed-top').css({'top': '32px', 'position': 'fixed'});
		}
	}
}

jQuery(document).ready(function(){
    wp_logged_in_menu_fix();
});

$(window).resize(function () {
	wp_logged_in_menu_fix();
});