VPS business hosting starting at $29.95/24/7 premium technical support

prevent sticky header jumping in css or js

jQuery(document).ready(function(){var header=jQuery("header .fusion-header");var headerHeight=0; var shouldWrite=1;
jQuery(window).on("scroll",function(){
headerHeight=header.height();
console.log(headerHeight);
if(shouldWrite && headerHeight!==undefined){
jQuery("#headerjumpfixer").html(".fusion-header-wrapper.fusion-is-sticky{padding-top:"+headerHeight + "px}");
shouldWrite=0;}
});
jQuery(window).on("resize",function(){shouldWrite=1;});
});
<style id="headerjumpfixer">.fusion-header-wrapper.fusion-is-sticky{padding-top:88px}</style>

Author: Harshvardhan Malpani

PHP Developer based in New Delhi, India. Working as a freelance web developer providing server deployment, website development and maintenance services.

Leave a Reply

Your email address will not be published.