Jump to content
Search Community

Draggable start position

blue-infinity
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

blue-infinity
Posted

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.

blue-infinity
Posted

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

Posted

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

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