Jump to content
Search Community

setting zIndex of Draggable not working

daveg test
Moderator Tag

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

Hi,

I and setting the zIndex parameter of the draggable, but it does not seem to work.

No matter what I do, the starting index stays at 1000.

this.draggableElems = new Draggable.create(droppables, {
      bounds: this.container.nativeElement,
      edgeResistance: 0.65,
      type: 'x,y',
      throwProps: true,
      liveSnap: false,
      zIndexBoost: true,
      zIndex: 9099,
  
  ETC

 

Link to comment
Share on other sites

1 hour ago, OSUblake said:

And this is incorrect syntax.


this.draggableElems = new Draggable.create(droppables); // bad

// for one element
this.draggableElems = new Draggable(droppables);

// for multiple elements
this.draggableElems = Draggable.create(droppables);

Thanks for the tip on this.

 

Link to comment
Share on other sites

1 hour ago, OSUblake said:

If you want to set the starting zIndex, do this.


Draggable.zIndex = 9099;

https://greensock.com/docs/v2/Utilities/Draggable/zIndex

 

You have zIndex boost to true, to it will keep adding 1 to that value every time you drag something.

Okay, yes this works.  I had been setting it as a variable and it did not work that way.  But setting it as the Docs say (go figure) works.
Thanks - thanks for setting me straight.

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...