This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

SiteOrigin Button: Smooth Transition on Anchor Link

Resolved 5 replies developerpluginplugin-widgets-bundle
Started · Latest reply by thomasrossi

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 ^_^

This is our free support forum. Replies can take several days.

Need fast email support? Get SiteOrigin Premium

Replies

5
  1. thomasrossi

    Sorry to up, but still unresolved :s

  2. Alex S Staff

    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.

  3. thomasrossi

    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

  4. Alex S Staff

    Hi Thomasrossi,

    Oh sorry! Please navigate to WP AdminSettingsPage Scroll to ID and set the selector to: .so-widget-sow-button a

  5. thomasrossi

    Wow, thank you! Works perfectly !

Replies on this thread are closed.

Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Have a different question or issue?

Start New Thread