Custom link jumps i.o. scrolls to right position

Hello Support Team,

I have made some custom links which jumps to the right position on the page but I prefer scrolling to the right position. How can I fix that? My site is: www.janzaal.nl/simad

Thanks in advance for your support.

Hi there,

Firstly you need to install and activate this plugin https://wordpress.org/plugins/tc-custom-javascript/
Then Go to “Appearance > Custom Javascript” and add the script below:

jQuery(function($){
    $(".menu-item a").click(function() {
	var links = [];
	var link  = $(this).attr('href');
	
	if(link.indexOf('#panel')) links = link.split('/');
	
	if(links.length){
           $('html, body').animate({
        	scrollTop: $(links[links.length - 1]).offset().top
           }, 1000);
        }
	return false;
   });
});

Thanks Awan,

Works very good.