<!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>
对自己好一点,放胆去肯定自己,有些路,通往哪里并不重要,重要的是你会在路上看到什么样的风景。幸福,从没捷径,也没有完美无瑕,只有经营,只靠真心。一切都会好起来的,即使不是在今天,总有一天会的。