Hi everyone,
I made a page and use a SiteOrigin Button linking to a different section to the same page.
This works perfectly, of course, but the jump is abrupt and i would like to have a smooth transition.
So, what I did, is I gave a class to my button:
my-intern-link
And using the plugin ‘Simple Custom CSS and JS’, I have added this JS code:
jQuery(document).ready(function( $ ){ // Smooth transition towards section on Menu click $(".my-intern-link").on("click", function(event){ event.preventDefault(); var hash = this.hash; $('body,html').animate({scrollTop: $(hash).offset().top} , 900 , function(){window.location.hash = hash;}) }); });
And this code just doesn’t work at all, when i click on the button, it doesn’t even jump at the section anymore.
Is there a better way to to what i want to achieve, or is there any qwack in my code ?
Thanks in advance ^_^
Sorry to up, but still unresolved :s
Hi Thomasrossi,
I would highly recommend using something like Page Scroll to ID instead of a custom solution. Once installed, please navigate to WP AdminSettingsPage scroll to id and set up the settings as desired.
Hi, thank you,
It works well with the menu but I don’t know how to make it works with the SiteOrigin Button.
I wrote a[rel=’m_PageScroll2id’] in the field ‘Button Classes’ (section ‘Other attributes and SEO’), but nothing happens :s
Hi Thomasrossi,
Oh sorry! Please navigate to WP AdminSettingsPage Scroll to ID and set the selector to: .so-widget-sow-button a
Wow, thank you! Works perfectly !