Jump to content
Search Community

cloned draggable element have etra styles and classes

one2gov test
Moderator Tag

Go to solution Solved by one2gov,

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

When I call .draggable() on cloned element it result in different size of element. I am not sure if .draggable() even from greensock, it's looks like it's from jquery. But how in that case should I clone  elements and have everything working?

$("#google").clone().prop('id', 'copy'+1).draggable().appendTo("#container");

EBuiwlK.png

See the Pen ENXgdq?editors=1111 by one2gov (@one2gov) on CodePen

Link to comment
Share on other sites

Hi one2gov,

 

I see an issue when cloning after moving the element, not when scaling. I have a little suspicion that there might be some conflict going on there but need to look into what might be.

 

Others might also have encountered this situation and might offer some help. For now, I'll ask you to hang on a bit.

 

Thanks.

  • Like 1
Link to comment
Share on other sites

Hello. yes it's jquery draggable. But greensock have draggable also. How to clone element and have greensock draggable working?

 

See the Pen ZBrzea by one2gov (@one2gov) on CodePen

 

Draggable.create(".box", {
  bounds:"#container",
  onDragStart:function() {
     xPosition.style.visibility = "hidden";
    yPosition.style.visibility = "hidden";
xPosition.innerHTML = this.target._gsTransform.x;
yPosition.innerHTML =  this.target._gsTransform.y
}
$("#google").clone().prop('id', 'copy'+1).appendTo("#container");
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...