1 回答
TA贡献1818条经验 获得超8个赞
<!DOCTYPE html>
<html>
<head>
<style>
div
{
width:100px;
height:100px;
background:red;
position:relative;
}
</style>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(function(){
var oldY= null;
var isdown = false;
$("#testcss").mousedown(function(e){
isdown = true;
oldY = e.clientY;
});
$("html").mousemove(function(e){
if(isdown){
$("#testcss").css("transform","rotate("+(e.clientY-oldY)+"deg)");
}
});
$("html").mouseup(function(e){
isdown = false;
oldY = null;
});
});
</script>
</head>
<body>
<div id="testcss"></div>
</body>
</html>
添加回答
举报