Adding smooth scrolling to reviews link

Nothing ground-breaking here, just a small edit to the Reviews link to make it snazzier.

jQuery (JS) code snippet :

jQuery(document).ready(function($) {
	//remove absolute url, just keep last part.
	jQuery(".hp-menu__item--listing-reviews a").attr("href","#reviews");

	//add smooth scroll 
	jQuery(document).on('click', 'a[href^="#"]', function (event) {
		event.preventDefault();

		jQuery('html, body').animate({
			scrollTop: jQuery(jQuery.attr(this, 'href')).offset().top
		}, 1500);
	});
});

Cheers !

1 Like

Hi,

Thank you for your solution, it will be useful for our community.

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