Jump to content
GreenSock

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

Reset position of an absolute positioned div after zoom and drag

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

Hello and thanks for any help you can provide guys.

Here´s my little issue:

  • I have a map
  • I need to zoom in/out this map.
  • When zoomed in, users may drag it to see the details.

 

Everything works, until I try to reset the map to it´s original scale/position. If I dragged the map, when the zoom out is selected, the scale goes right, but the position goes wrong. I want the position to be reset to the original values but it goes crazy if I made a drag of it.

 

Also, as a plus....it is possible to make this zoom in, according to the user mouse click?

 

Sorry for my grammar! :)

 

Regards!

See the Pen empmwv by enguez (@enguez) on CodePen

Link to comment
Share on other sites

  • Solution

Hi enguez  :)

 

i changed your code and DOMs a bit , hope that helps , and i think in this case that would be better to using SVG graphic :

 

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

Link to comment
Share on other sites

Hey Diaco, thanks, works like a charm. Now I can see how you defined the boundaries and position.

And yes, I will use a svg instead these png to avoid blur, is a little more weight but it worths.

Regards!

Link to comment
Share on other sites

What about the other question?
How to apply this zoom in the area where the user made a click/touch?

 

Regards!

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