• Hi,

    I created a one page site with the Zerif Lite theme. I really appreciate the smooth scrolling effect when we click on the menu items in order to get to the proper section.

    Problem: Smooth scrolling is not working with any other links outside the menu. For example, in the Pricing section of my website (https://www.siddhartha-translations.com/en/), there is a link to go to the Contact section, on the same page, but it doesn’t scroll smoothly, it jumps right at the Contact section.

    Question: Is there a way to solve this problem and enable smooth scrolling everywhere within the site, not just in the menu?

    Looking forward to your help,
    Best regards,

    Siddhartha

Viewing 1 replies (of 1 total)
  • Hi Siddharth,

    You can add the following jQuery to your WordPress, using a plugin or a child theme, to make that work:

    /* Smooth Scroll */
    jQuery('a[href*="#"]').click(function() {
    	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
    		var target = jQuery(this.hash);
    		target = target.length ? target : jQuery('[name=' + this.hash.slice(1) +']');
    		if (target.length) {
    			jQuery('html,body').animate({
    				scrollTop: target.offset().top
    			}, 1200);
    			return false;
    		}
    	}
    });

    Let me know if it works after that. ??

Viewing 1 replies (of 1 total)
  • The topic ‘Smooth scrolling not working in Sections’ is closed to new replies.