intersect function element1 element2 var x1 parseInt element1 style le

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
intersect: function(element1, element2)
{
var x1 = parseInt(element1.style.left);
var y1 = parseInt(element1.style.top);
var w1 = parseInt(element1.style.width);
var h1 = parseInt(element1.style.height);
var x2 = parseInt(element2.style.left);
var y2 = parseInt(element2.style.top);
var w2 = parseInt(element2.style.width);
var h2 = parseInt(element2.style.height);
return !((x1 > x2 + w2) || (x1 + w1 < x2) || (y1 > y2 + h2) || (y1 + h1 < y2));
},