Jump to content
Search Community

Sanjero

Members
  • Posts

    11
  • Joined

  • Last visited

Posts posted by Sanjero

  1. Hi,

     

    I have a issue with using GSAP and jQuery at same time.

    My GSAP code is working fine without jQuery but once I import jQuery to the index page I face the below strange behavior:

     

    When I refresh the page, GSAP losing the scroll position.

     

    Please open the below URL and scroll down to see the section animations, then refresh the page and try scrolling from top, you will see the issue.

     

    I used the below code to prevent the browser from saving the scroll position on refreshing page, which that works for the browser but for GSAP doesn't work and GSAP losing the scroll position which is because of jQuery I think.

     

    if (history.scrollRestoration) {
      history.scrollRestoration = "manual";
    else {
      window.onbeforeunload = function () {
        window.scrollTo(00);
      };
    }
     
    I'm using:
    GSAP 3.7.1
    and
     
    Thanks in advance.
     
     

    See the Pen oNwvJKY by Sanjero (@Sanjero) on CodePen

×
×
  • Create New...