<!DOCTYPE html>
<html>
<meta http
<title>簡單拖曵原理實例</title>
<style type="text/css">
#drag{width:
h
</style>
<script src="
<script type="text/javascript">
$(function(){
/*
*原理
* mousedown:fn(){dragging = true
* mouseover:fn(){判斷如果dragging = true
* mouseup:fn(){dragging = false
*/
var dragging = false;
var iX
$("#drag")
dragging = true;
iX = e
iY = e
this
return false;
});
document
if (dragging) {
var e = e || window
var oX = e
var oY = e
$("#drag")
return false;
}
};
$(document)
dragging = false;
$("#drag")[
e
})
})
</script>
</head>
<body>
<div id="drag">
<h
</div>
</body>
</html>
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20094.html