Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
andyr

Draggable. zIndexBoost.

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I've got a gallery of items. 

 

When dragged, the box's z-index appears to be higher than elements created before, but lower than ones created after.  

 

I want the z-index (for the dragged item) to be higher than all other items, not just the ones created before in the DOM.  

 

ie box 1 should move on top of boxes 2 - 5, not under them.

 

I've tried ZIndexBoost. 

 

Edit: I've also tried applying style.zIndex="" on click, but it's not working.

See the Pen YXwvJq by andyroutledge (@andyroutledge) on CodePen

Link to comment
Share on other sites

Hi Andy

 

Thanks a lot for the demo. VERY helpful.

z-index only works on element that have a css position applied.

just add position:relative to your .g and you should be good to go

 

http://codepen.io/GreenSock/pen/PqZyjG

  • Like 4
Link to comment
Share on other sites

Doh.  

 

Thanks Carl.

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.

×