Jump to content
GreenSock

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

Change DOM structure of draggable element while dragging cause element jump

Go to solution Solved by Diaco,

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!

 

Im building a thing where I drag a element and check with hitTest for another element. I need to change the DOM structure so the dragger element gets inside ".drop-here" element as soon the hitTest is true. It works fine but the draggable elements gets jumpy when dragging to the ".drop-here" area.

 

I need to reset/update the coordinates I guess but dont now how. I tried using draggable.update() with no success. Any suggestion to solve this problem?

 

Many thanks!

See the Pen mJNRoG by anon (@anon) on CodePen

Link to comment
Share on other sites

You make a clone of what you are dragging and set the clones position relative to something that won't change, like the top-left corner.

 

See the Pen XJQKVX by osublake (@osublake) on CodePen

  • Like 3
Link to comment
Share on other sites

  • Solution

Hi sumimasenga  :)

 

in addition to blake's advise , you can also do something like this : 

See the Pen eNqGVb by MAW (@MAW) on CodePen

  • Like 3
Link to comment
Share on other sites

Thanks for both answers!

I went for Diaco's advise.

 

Really appreciate this!

 

Many thanks!

Link to comment
Share on other sites

  • 1 year later...

I know it's been over a year, but here is a few connected lists.

 

See the Pen mAyyQP by joelcoxokc (@joelcoxokc) on CodePen

Would anyone know how I could make each individual column scrollable?

 

Also, should I create an individual thread for this question?

Link to comment
Share on other sites

Hello Joelcox, and welcome to the GreenSock Forum!

 

Yeah this could be a new topic, but try this using on your main section elements

 

See the Pen mAyyQP by joelcoxokc (@joelcoxokc) on CodePen

.container {
  overflow-y:auto;
  overflow-x:hidden;
}

That is one way to do it when the items in the container extend past the height of the combined list-items.

 

Does that help? :)

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