Footer Menu Item Scroll To Top

Hi,

We would like to have a footer menu item “Back To Top” that will scroll to top like scroll anchor icon.

Please advise.

Thanks, MB

Hi there,

Thanks for writing around! To achieve this, please add the following script in your Customizer via Appearance > Customize > Custom > Edit Global Javascript

jQuery(document).ready(function($) {
	$('#menu-item-5372 a').click(function(){
		$('html, body').animate({
			scrollTop: 0
		}, 850, 'easeInOutExpo');
	});
});

Don’t forget to clear your browser’s cache after adding the code. Let us know how this goes!

This seems to work except it flashes the screen when activated. Any solution to stop the flashing? Thanks

Hi there,

To fix the flashing issue, please replace the previous code with this one:

jQuery(document).ready(function($) {
	$('#menu-item-5372 a').click(function(event){
        event.preventDefault();
		$('html, body').animate({
			scrollTop: 0
		}, 850, 'easeInOutExpo');
	});
});

Don’t forget to clear your browser’s cache after adding the code. Cheers!

Great thanks!

You’re welcome!
We’re glad we were able to help you out.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.