<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div style="border: 1px solid #ddd;width: 600px;position: absolute;">
<div id="title" style="background-color: black;height: 40px;color: white;">
<strong>标题</strong>
</div>
<div style="height: 300px;">
内容
</div>
</div>
<script type="text/javascript" src="../../jquery-1.12.4.js"></script>
<script>
$(function () {
$('#title').mouseover(function () {
$(this).css('cursor','move');
}).mousedown(function (e) {
var _event = e || widows.event;
var ord_x = _event.clientX;
var ord_y = _event.clientY;
var parent_left = $(this).parent().offset().left;
var parent_top = $(this).parent().offset().top;
$(this).bind('mousemove',function (e) {
var _new_event = e || window.event;
var new_x = _new_event.clientX;
var new_y = _new_event.clientY;
var x = parent_left + (new_x - ord_x);
var y = parent_top + (new_y - ord_y);
$(this).parent().css('left',x+'px');
$(this).parent().css('top',y+'px');
})
}).mouseup(function () {
$(this).unbind('mousemove');
});
})
</script>
</body>
</html>
人不仅要做好事,更要以准确的方式做好事。人生最大的快乐不在于据有什么,而在于追求什么的过程。任何业绩的质变都来自于量变的积累。强者会哭,但绝不会认输。