Scrolling not working

I can’t get the scrolling to work on one of my pages. I am setting up a FAQ page and every time it scrolls it then scrolls up and covers the text. I have tried many things from the forum but none have worked. The page is cookeproductions.site/faq

Hello There,

Thanks for writing in! Please have the JS code updated and use this instead:

(function($){
  $(document).ready(function() {
      $('a[href*=#]:not([href=#])').click(function() {
        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
          var target = $(this.hash);
          target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
          if (target.length) {
            $('html,body').animate({
              scrollTop: target.offset().top - 100
            }, 1000);
            return false;
          }
        }
      });
  }); 
})(jQuery);

You can adjust the jump by reducing/increasing the 100 in the code.

Hope this helps. Please let us know how it goes.

I put in the new code and it works for a second then it goes back up and covers that section.

Hello There,

There is a duplicate JS code. Please go to the theme options custom JS in the Theme Options > Global JS (http://prntscr.com/evswzb) or in the customizer, Appearance > Customize > Custom > Edit GLOBAL Javascript and remove the duplicate code.

Please let us know how it goes.

That worked thank you. This may be out of the scope of support but is there a way to add a scroll to top anchor on the page?

Hi,

Xtheme has a builtin scroll to top feature.

You can enable it under Theme Options > Miscellaneous

Thanks

That worked perfectly. Thank you again.

You’re welcome! :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.