-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dnd_Plug.js
46 lines (33 loc) · 1.08 KB
/
Dnd_Plug.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
;
(function ($){
$.fn.rostykPlug = function (elems){
var obj = this;
console.log(obj);
window.onload = function (){
var $div = $("<div/>",{text : elems.text});
var style = {
width : elems.width + "px",
height : elems.height + "px",
backgroundColor : elems.backgroundColor,
borderRadius : elems.borderRadius,
position : elems.position,
lineHeight: elems.height + 'px',
textAlign: "center",
fontSize : elems.fontSize,
fontWeight : elems.fontWeight,
color : elems.textColor
}
$div.css(style);
$div.onmousedown = function (emd){
document.onmousemove = function (emm){
$div.style.top = emm.pageY + "px";
$div.style.left = emm.pageX + "px";
}
}//down
$div.onmouseup = function (emu){
document.onmousemove = null;
}
$(obj).append($div);
}//onload
}
}(jQuery));