Jump to content
Search Community

Navigation order in mobile

Israr test
Moderator Tag

Recommended Posts

Hi @Team

 

I have made a menu with gsap animation but I have faced one issue in mobile. When I changed the menu item order in mobile using CSS media query the animation on menu items worked as an original list item shown in HTML.

I want the animation to work on mobile in the order I used in the CSS media query.

 

I will be very thankful to you

 

Regards,

Israr Ul Haq

See the Pen xxBVYPE by israr-ul-haq (@israr-ul-haq) on CodePen

Edited by Israr
Link to comment
Share on other sites

I have changed using matchmedia, but the order of items have behaved like original HTML, not changed the animation on basis of order that I mentioned in codepen   

Link to comment
Share on other sites

Heya!

So GSAP doesn't know what order your element are in visually. All it knows is the order the elements are in in the HTML (DOM).


If I were you I'd create an array in JS that has the menu items in the order you need them and then stagger that array, or you could physically reorder the items in the DOM yourself

Hope this helps.

Screenshot 2024-01-07 at 14.37.17.png

  • Like 2
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.
×
×
  • Create New...