2017-12-03 14 views
0

여기가 내 첫 번째 게시물이므로 올바르게 처리하기를 바랍니다. 0과 10deg 사이에서 다르게 각각을 기울이기 위해 임의의 값을 일련의 대화 상자 위젯에 할당하려고합니다. 불행히도 작동하지 않습니다. 누구든지 아이디어가 있습니까?jQuery UI 대화 상자 무작위 CSS 속성

<div id="dialog" class="pops" title="1"> <img src="print1.jpg"></img> 
</div> 

<div id="dialog2" class="pops" title="2"> <img src="print2.jpg"></img> 
</div> 

<div id="dialog3" class="pops" title="3"><img src="print3.jpg"></img> 
</div> 

JQuery와 (대화 및 addClass)

$(function() { 
$(".pops").dialog({ 
draggable: false, 
resizable: false, 
width: 'auto', 
height: 'auto', 
modal: true, 
dialogClass:'storto', 

open: function(e, ui) { 
    $(this).siblings(".ui-dialog-titlebar") 
    .find("button").blur(); 
} 
}); 
}); 

CSS

.ui-dialog.storto{ 
padding:0; 
height:auto; 
margin:0; 
transform: skewY(10deg); 
} 

jQuery를이

$(".ui-dialog.storto").each(function() { 
var rNum = (Math.random()*4)-2; 
$(this).css({ 
'transform': 'skewY('+rNum+'2deg)' 
}); 
}); 

답변

0

좋아, 그것을했다 (작동하지 않는) CSS를 변경합니다.

open: function(e, ui) { 
$(".ui-dialog.storto").each(function() { 
var rNum = (Math.random()*10)-1; 
$(this).css({ 
'transform': 'skewY('+rNum+'2deg)' 
}); 
}); 
}