Jump to content
GreenSock

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

Conflict between Draggable and click triggered rotation

Recommended Posts

 

I have a dial that works as expected when dragged but should also rotate to the selected year when clicked. This is when it behaves erratically. I have posted this CodePen to better illustrate the problem.

I consoled log the index of the clicked element to make sure it was the right element that has been clicked. It is also colored black on hover. Once the dial is loaded the first click will return the right data and rotate the dial to the expected position. The next click won't it won't even output the expected message (clicked index) on the console.

It looks like the problem is on the rotation TweenLite line TweenMax.to($("#dial_square"), 0.7, { rotation:theta }); on the giraDial() function. If I comment out this line on the giraDial() function then the click triggers the function and the console outputs the expected values but obviously, without dial rotation.

function giraDial(laPos){

    var theta = -1-laPos*36;
    $('.anual').removeClass('activo');

    var girar;
    $('.diametral').each(function( indx, elmt ){
        girar = indx*-36 - theta;
    //TweenLite.to($(this).find('.anual'), 0.8, { rotation:girar });
    });

    //TweenLite.to($("#dial_square"), 0.8, { rotation:theta });
    TweenLite.to($(".anual"), 1.8, { opacity:0.8 });

    $anuales[laPos].addClass('activo');
    return theta;
}

I've been struggling with this for a couple of days now and can't find a solution or a similar problem.

The final work can be seen here too: http://report2016.barentsre.com/ (navigate to the timeline section).

See the Pen qXegLO by zjorge (@zjorge) on CodePen

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