Jump to content
Search Community

Draggable - Get current object postion and save it

Crtl-Alt-Delete test
Moderator Tag

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

Hey Guys,


i was playing around with the awesome Draggable Library and i wondered how i go about saving(DB) the postion of the currecnt object  and load it again later?





i tried the following,  but not sure if it's correct approach( since the values return includes translate3d):  

   onDragEnd: function() {
                     var obj = $(this._eventTarget);
                   // option one
                    var pos = item.position();;
                    var posx = pos.left;
                    var posy = pos.bottom;
                    console.log(parseInt (posx ) );
                    console.log( parseInt (posy ));

                   // option two
                   console.log(parseInt (this.y) );
                   console.log( parseInt (this.x));                
Link to comment
Share on other sites


Hi Crtl-Alt-Delete  :)


you can easily get draggable current position by this.x / this.y , like this :


TweenLite.set('.box',{x:100,y:100}); // set position

  console.log(this.x+','+this.y) // get position


Hi Diaco


thanks for the reply,  that worked like  a dream :-) :smile: :-) :smile:

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