Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
blue-infinity

Draggable start position

Recommended Posts

Hello,

 

I would like to initialize the start draggable plugin, at a position of 50% Y of the drag path ? (could apply on a for example circle). Is there any easy way to do it ?

 

Thank you.

See the Pen remjXv by lbineau (@lbineau) on CodePen

Link to comment
Share on other sites

Hi blue-infinity  :)

 

pls check this out : 

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

 

Thanks for the answer ! I think I also have to listen for the image loading, because the code is not working the first time (I guess that the dimensions of the image is not detected properly).

Link to comment
Share on other sites

yep and another simplest solution ( without js ) is simply change your img css to this :

img {
  max-width: 100%;
  height: auto;
  top:50%;
  transform:translate(0%,-50%);
  position:absolute;
}

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

  • Like 2
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.
×