html
<div id="tipBox">
<div class='head'></div>
<div class='content'>
...
</div>
</div>
js
var $div = $("#tipBox .head");
$div.on("mousedown",function(event){
var offset_x = $(this).parent()[0].offsetLeft;
var offset_y = $(this).parent()[0].offsetTop;
var mouse_x = event.pageX;
var mouse_y = event.pageY;
$(document).on("mousemove",function(ev){
var _x = ev.pageX - mouse_x;
var _y = ev.pageY - mouse_y;
var now_x = (offset_x + _x +150) + "px";
var now_y = (offset_y + _y +100) + "px";
$div.parent().css({
top:now_y,
left:now_x
});
});
});
$(document).on("mouseup",function(){
$(this).unbind("mousemove");
});