WordPress Tricks

Click on Link and Scroll to ID: Fix Overlapping issue of top fixed header

Sometimes you face issue where Top fixed header overlap the portion of the Target. To fix the issue you can use this jquery code. You need to have good understanding about how to use it. Or do a comments if you need help

You need to change the Parent Element ID or Class in the provided code

 jQuery('Parent Element ID or Class').on('click', 'a', function(e){
		   e.preventDefault();
		   e.stopImmediatePropagation();
	var id=	jQuery(this).attr('href');
		 console.log(id);
 jQuery('html,body').animate({scrollTop: jQuery(id).offset().top -180},'slow');
	   });

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s