var windows function var moveMode var xOffset var yOffset title unbind

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
var windows = function() {
var moveMode = 0;
var xOffset = 0;
var yOffset = 0;
$(".title").unbind().on("mousedown", function(e) {
if ($(this).attr("moveable") != "false") moveMode = 1;
var parent = $(this).parent();
xOffset = e.pageX - parseInt(parent.css("left"));
yOffset = e.pageY - parseInt(parent.css("top"));
}).on("mouseup", function() {
moveMode = 0;
});
$(".window").unbind().on("mousemove", function(e) {
if (moveMode) {
$(this).css({top: e.pageY - yOffset, left: e.pageX - xOffset});
}
}).on("mousedown", function() {
$(".window").css({zIndex: "999"});
this.style.zIndex = "1000";
});
}