Home>Support>SiteOrigin Button: Smooth Transition on Anchor Link

SiteOrigin Button: Smooth Transition on Anchor Link

Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].

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. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 8 years, 4 months ago thomasrossi

    Sorry to up, but still unresolved :s

  2. 8 years, 4 months ago Alex S
    Hi, I Work Here

    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. 8 years, 4 months ago 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. 8 years, 4 months ago Alex S
    Hi, I Work Here

    Hi Thomasrossi,

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

  5. 8 years, 4 months ago 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.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More