I have made a website all in a page with anchor links set. When I click on the menu contact item it scrolls smoothly right down to the "Contact" section. I want to delete the smooth scrolling effect and redirect straight away to that section without scrolling slowly to the bottom of the page.
I’m using the elementor builder with wordpress. Is there a Jquery function or CSS code that can remove the smooth scrolling?
Thank you in advance for your help.
2
Answers
Unfortunatly, Elementor has no easy way to remove this option.
However, there are some ways to work around it. What I have done in the past is to simply use a HTML Widget instead of an anchor widget.
Basically, put the HTML Widget where you would need your users to land after clicking your link, and manually add an empty div that represents the anchor, like so:
Your link :
#no-smooth-scroll
should now take your users to where the div is without the smooth scroll option.Just tested this workaround to make sure it still works, and it does on my website.
Hope it works for you !
There is no UI option in Elementor to disable smooth scroll, however it can certainly be disabled using an option below (uses Elementor JS Hooks).
Option 1 using Code Snippets plugin – arguably the best way since it doesn’t require Elementor Pro and because it ensures that Elementor is loaded before the script runs.
Copy this- you’ll use it in Step 3
disable elementor smooth scroll
Option 2 using Elementor Pro
Copy this- you’ll use it in Step 3.
disable elementor smooth scroll
Location
to<body> - End
(this is a drop-down above the code editor)Priority
to10
(also a drop-down above code editor) – not necessary but I see no reason to make this load before other scriptsCondition
set toEntire Site
or set to whatever conditions you need.Option 3 using a custom JS plugin such as Simple Custom CSS and JS
Note: these are general directions – follow the plugin docs for exact implementation.
Option 4 using child theme
If you understand the heading, then you’re a theme developer, so I’ll simply say that you can monkey it into your functions.php file, a template file, or add the JS code (within a
<script>
block) to its own .js file and include it however you like.AS ALWAYS, CLEAR CACHE
After completing any procedure above and testing, if you use any local caching plugins, clear them. If you use Cloudflare or a CDN, purge it.
Credit
@jamesckemp’s awesome solution to disable Elementor smooth scroll on github