2017-10-14 6 views
2

안녕 우리는 사업부jQuery를 회전() 정도

$(function() { 
 

 
     $('.new-multiple').rotatable(); 
 
});
.new-multiple{ 
 
    display:inline-block; 
 
}
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> 
 
<script src="https://code.jquery.com/jquery-1.12.4.js"></script> 
 
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> 
 

 
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/godswearhats/[email protected]/jquery.ui.rotatable.css"> 
 
<script src="https://cdn.jsdelivr.net/gh/godswearhats/[email protected]/jquery.ui.rotatable.min.js"></script> 
 

 
<div class="new-multiple"> 
 

 
    <img src="https://www.gravatar.com/avatar/322f808cb7a7e06d38ca4c8a441332fd?s=48&d=identicon&r=PG&f=1"> 
 
    </div>

을 회전 JQuery와 rotatble 플러그인을 사용하지만 문제는 복사 옵션을 사용하여 DIV를 회전한다는 것이다. 하지만 학위를 사용하여 div를 회전해야합니다. 0 ~ 360도입니다. 당신이 https://github.com/godswearhats/jquery-ui-rotatable에서 문서를 검토 할 경우 우리는이

내가

.rotatable({ 
     options: { 
      degrees: true 
     } 
});  

을 시도 달성 할 수 있지만,이

+0

은 [이] 한 번 봐 (되세요 중지 이벤트에 정도 주어진 라디안 변환 https://www.w3schools.com/tags/ trypt.asp? filename = tryhtml5_canvas_rotate) – matt

+1

@matt 캔버스 회전이 jQuery UI 플러그인 및 CSS와 어떻게 관련이 있는지 잘 모르겠습니다. – Twisty

답변

0

내가

$('.new-multiple').rotatable({ 


     stop: function(e, ui){ 
      if(ui.angle.current<0){ 
        var given_angle=ui.angle.current+2*Math.PI; 
       } 
       else{ var given_angle=ui.angle.current; } 
       var new_angle=Math.round(given_angle*180/ Math.PI)+"deg"; 
       $(".new-multiple").css("transform","rotate("+new_angle+")"); 
     } 

    }); 
+0

'ui.angle °'는 학위를 제공합니다. . – Twisty

+0

나는 이것을 점검 할 것이다. ("new-multiple")을 의미합니다. css ("transform", "rotate ("+ ui.angle ° + ")"); ? –

1

작동하지 않습니다 어떻게 볼 수 있습니다 :

degrees : 각도 선발진 (기본값 0)

따라서 시도한대로 옵션을 사용할 수 없습니다. true이 아니라 0에서 360 사이의 값인 int이어야합니다. 당신이 45도 회전을 초기화하고자하는 경우

예를 들어, 다음을 사용 : 도움이

$(function() { 
    $('.new-multiple').rotatable({ 
    degress: 45 
    }); 
}); 

희망을. 난 정도 회전을 얻을 필요가 있기 때문에

+0

이것을 확인하시기 바랍니다. https://stackoverflow.com/questions/48319486/image-orientation-changing-in-jquery-image-upload-and-preview-function –