Jump to content
Search Community

Draggable div always goes to the top of page instead of where you throw it

jacob_truax 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

Hello, 

 

As said above, I am having an issue where when I throw or drag the draggable div it is always bound to the top of the page like a magnet. I didn't set it like this, and can't figure out how to let it move where ever it is being thrown. Does anyone know why this is happening?

 

Here is the link to the repository and to the site. 

https://github.com/jacobtruax/Mole-End

https://jacobtruax.github.io/Mole-End/

 

Thanks

Link to comment
Share on other sites

It looks like that rule isn't being applied to the container on larger screens. You're only setting that height on max 750px in the media query. If you change that, I think you'll be all set.

 

Happy tweening.

:)

 

PS The media query block also isn't closed — just FYI.

  • Like 1
Link to comment
Share on other sites

Thank you for that! Everything is fixed and pushed to github. I had another question, I am trying to create a different bounding area now. I have it set up like this bounds: {top:200, left:0, width:1000, height:800} but is there a way to make the width something like 100vw? Can I make a variable that is the width of the window and add the variable as the unit? 

Link to comment
Share on other sites

Ah yes that makes sense. A lot more simple! I tried but there still seems to be an issue. As you can see the container is below the top header, but for some reason the draggable item no longer goes to the bottom of the page. (Same github link)

 

Thanks so much

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