87,910
社区成员
发帖
与我相关
我的任务
分享
<div id="dd" style="background: red;width: 200px;height: 200px;"></div>
<script type="text/javascript">
$("#dd").mousemove(function(event){
var x = event.pageX - $(this).offset().left;
if (x > $(this).width()/2) {
$(this).css("transform","rotate(30deg)")
} else {
$(this).css("transform","rotate(-30deg)")
}
})
</script>