Ctrl+/
IE11
F11
ESC
PgUp
PgDn
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery-拖动层(在可视区域范围内)
</title>
<script type="text/javascript" src="http://ku.shouce.ren/libs/jquery/1/jquery1.8.0.min.js">
</script>
</head>
<body>
<div class="box">
<div class="top">这里按下鼠标移动
</div>
<div class="content">这里放置内容
</body>
</html>
xxxxxxxxxx
*{
margin:0px;
padding:0px;
}
body{
background:#999999;
.box{
position:absolute;
top:200px;
left:500px;
width:300px;
margin:0 auto;
border:1px solid #F63;
cursor:move;
.top{
background:#006666;
color:#FFFFFF;
text-align:center;
font-weight:bold;
height:30px;
.content{
background:#FFF;
height:200px;
padding:10px;
(function($){
$.fn.extend({
mydrag:function(){
var boxX = 0;
//元素在页面中的横坐标
var boxY = 0;
//元素在页面中的纵坐标
var dMouseX = 0;
//按下鼠标时的鼠标所在位置的横坐标
var dMouseY = 0;
//按下鼠标时的鼠标所在位置的纵坐标
var mMouseX = 0;
//移动鼠标时的鼠标所在位置的横坐标
var mMouseY = 0;
//移动鼠标时的鼠标所在位置的纵坐标