Jump to content
Search Community

Draggable Knob Spin problem in Chrome

gmgurgen 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

A quick and dirty way would be to put simple click targets in those positions and allow a click event to push the knob to those positions. A little CSS to position and hide ... and a little JS to update the draggable object.

 

See the Pen bvpbZR by sgorneau (@sgorneau) on CodePen

 

I'm sure a better method would be to use the Draggable's onClick method to get mouse coordinates and determine the click position relative to the knob and logic to determine the closest snap point. But for a few simple snap-to points, a couple of clickable elements might be what you're looking for.

 

EDIT: Based on your positioning things ... you may want to look at this in CodePen itself ... seems some relative positions are causing the clickable elements to not align.

 

EDIT 2: Reduced your pen down to simplify it for positioning.

 

  • Like 5
Link to comment
Share on other sites

It's actually useful but, i have another problem right now.
It needs to updateData too, i couldn't call updateData function in click on snap-tos.

I need it because, when the knob turns, it actually makes some tweens on original page. Because there are lots of codes, i didn't embed them in this.

See the Pen dJzoKv by gmgurgen (@gmgurgen) on CodePen

 

Link to comment
Share on other sites

The current version of i shared last, it gets tween if i click on knob after click on snaptos points. Why doesn't it set tween in the first click.

It also doesn't work if second click on "snap-tos li". It works only click on knob except "snap-tos li".

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