Jump to content


click, change page, scroll to plugin

Moderator Tag

Recommended Posts

How can I do this event


Click menu, change page if not a hompage and after change scroll to id? 

Link to comment
Share on other sites

Hey tokemtomczuk.


Your post is not entirely clear. Are you wanting to know more about transitioning between pages? Or only how to scroll somewhere on a page based on what was clicked in a previous page?

Link to comment
Share on other sites

My website menu contains: about, blog and contact. About and contact are located in a home page. Blog is located on a separate page. 

When I'm on a blog page and click about,  I would like to

a) change to home page

b) scroll to #about id using scrollToPlugin.


Am I now clearer? 

Link to comment
Share on other sites

Yes, that makes sense. 


On the index page, have the following HTML:

  <a href="#about">About</a>
  <a href="/blog">Blog</a>
  <a href="#contact">Contact</a>

On your other pages have this HTML:

  <a href="/#about">About</a>
  <a href="/blog">Blog</a>
  <a href="/#contact">Contact</a>

Then you can use the code in the demo below to do what you want:

See the Pen ExKNEXY?editors=0010 by GreenSock (@GreenSock) on CodePen

  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...

Hey! I wanna do the same thing but in next.js. Help would be great.


Link to comment
Share on other sites

Hi there!


We love helping with GSAP-related questions, but unfortunately we just don't have the resources to provide free general consulting, logic troubleshooting, or tutorials. Of course anyone else is welcome to post an answer if they'd like - we just want to manage expectations.  


You can post in the "Jobs & Freelance" forum for paid consulting, or contact us directly. 


Otherwise, if you've got a GSAP-specific question just post that along with a minimal demo and we'd be happy to take a look. You're much more likely to get help if you've attempted a solution and can explain where and why you got stuck.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.