How to grab and drag an element around a circle?

后端 未结 2 1541
不知归路
不知归路 2021-01-03 17:46

So far I have a circle with a marker.

http://jsfiddle.net/x5APH/1/

I would like to grab and drag the marker around the circle, however the current functional

2条回答
  •  一整个雨季
    2021-01-03 17:53

    changed some code

            $(document).ready(function(){               
    
                $('#marker').on('mousedown', function(){
                    $('body').on('mousemove', function(event){
                        rotateAnnotationCropper($('#innerCircle').parent(), event.pageX,event.pageY, $('#marker'));    
                    });
    
                });                    
            }); ​
    

    also add this code

    $('body').on('mouseup', function(event){ $('body').unbind('mousemove')}); 
    

    in the function

    this is the jsfiddle http://jsfiddle.net/sandeeprajoria/x5APH/11/

提交回复
热议问题