Avoid smooth scroll to named anchor in the home page


First of all shout-out to you for this illdy theme. It’s user friendly and beautiful. Most of my questions where already documented on this forum which is much appreciated.

Now I’m looking for a way to avoid the smooth scroll effect which happen when I use named anchor from the top menu to specific part of the home page. I would like the user to jump directly to the specific part without seeing anything else.

Is it possible?


Hello @illdyfan,

First of all, thank you very much for the kind words and for using our products.

This is quite the first time I get to see this request, so I need to document it myself.

If I suspect alright, the code should be found in the theme files > js > custom.js

Let me know if you want to handle some coding and I’ll do my best to find the solution for this.

Best regards

Thank you!

As the code has good/obvious comments I got it working but I’m not sure it doesn’t have side effect nor if it’s the best way to do it.

Here is the workaround :

Edit the scripts.js file ( [wordpress_root]/wp-content/themes/illdy/layout/js/scripts.js )

Comment the function named “Smooth Scroll Anchors” :slight_smile:

Minify the all scripts.js including modifications (https://jscompress.com/ can be used).

Backup the scripts-min.js ( [wordpress_root]/wp-content/themes/illdy/layout/js/scripts.min.js ).

cp [wordpress_root]/wp-content/themes/illdy/layout/js/scripts.min.js [wordpress_root]/wp-content/themes/illdy/layout/js/scripts.min.js.bak

Replace the scripts-min.js content with the minified scripts.js content.

Reload the web browser content with the CTRL+F5 shortcut to avoid caching the old js file.

Commenting the all “Smooth Scroll Anchors” function was wrong as the menu couldn’t work when reduced (e.g. on smartphones). Instead I modified the following part :

    scrollTop: target.offset().top
}, 1000);

to :

    scrollTop: target.offset().top
}, 0);

@colorlibsupport Is this OK ?

Hello @illdyfan,

It looks like you got quite forward with this modification, but I cannot say exactly if or what you are missing.

From the last code it seems alright, as you change the animation time from 1000 to 0 and it should go to the anchor in an instant.

Also you say that you placed the code in the minified file, so everything should be running just alright, can you please confirm it?

Best regards


Modifying the animation time from 1000 to 0 worked.

Thanks for your help!

Can someone help me please i don’t know how to start a forum and i already tried to come in contact but nobody replies to me, my smooth scroll doesnt work on the illdy theme and my website is : www.syerg.nl please someone help me so i can start my business

Hey @kcrng,
Hope you’re doing well today

What exactly is the issue you’re having?
I’m not seeing any menu items on your homepage so I’m guessing you need to go to Appearance > Menus and add some custom links to your menu with the various labels you need. You’ll need to ensure that the link to these menu items are the IDs for the sections on your homepage. The ID is found in Appearance > Customize > Front Page Sections. the ID for each section is # followed by the first word, in common letters. For Example, the About Section’s ID is #about.

I hope this helps :slight_smile:

Best Regards,

I already tried that and it still doenst work what can i do now