1. html 引入drag
2.使用插件
$("#hoverMap").dragging({
move : 'both',
scope:".ondetails_div",
randomPosition : false ,
hander:'#twoGis_header'
});
3.使用draggable插件,附上移动函数
$(“.popup_help”).draggable({cursor: “move”,handle:”.popup_head2”,onDrag:onDrag});
ondrag 事件在元素或者选取的文本被拖动时触发。
function onDrag(e){
var d = e.data;
//if (d.left < -501){d.left = 0}
if (d.top < 57){d.top = 57}
if (d.left + $(d.target).outerWidth() > $(d.parent).width() - d.left -30){
d.left = $(d.parent).width() - $(d.target).outerWidth() - $('.left_content_container').width()-20;
}
if (d.top + $(d.target).outerHeight() > $(d.parent).height()){
d.top = $(d.parent).height() - $(d.target).outerHeight();
}
}