lib/client/is_visible.js
function collides(element_one, element_two) {

	var result,
	    rect1,
	    rect2;

	if (element_one.nodeName) {
		rect1 = element_one.getBoundingClientRect();
	} else {
		rect1 = element_one;
	}

	if (element_two.nodeName) {
		rect2 = element_two.getBoundingClientRect();
	} else {
		rect2 = element_two;
	}

	result = !(
		rect1.top    > rect2.bottom ||
		rect1.right  < rect2.left ||
		rect1.bottom < rect2.top ||
		rect1.left   > rect2.right
	);

	return result;
}
function collides(element_one, element_two) {

	var result,
	    rect1,
	    rect2;

	if (element_one.nodeName) {
		rect1 = element_one.getBoundingClientRect();
	} else {
		rect1 = element_one;
	}

	if (element_two.nodeName) {
		rect2 = element_two.getBoundingClientRect();
	} else {
		rect2 = element_two;
	}

	result = !(
		rect1.top    > rect2.bottom ||
		rect1.right  < rect2.left ||
		rect1.bottom < rect2.top ||
		rect1.left   > rect2.right
	);

	return result;
}
function collides ( element_one , element_two ) { var result , rect1 , rect2 ; if ( element_one . nodeName ) { rect1 = element_one . getBoundingClientRect ( ) ; } else { rect1 = element_one ; } if ( element_two . nodeName ) { rect2 = element_two . getBoundingClientRect ( ) ; } else { rect2 = element_two ; } result = ! ( rect1 . top > rect2 . bottom || rect1 . right < rect2 . left || rect1 . bottom < rect2 . top || rect1 . left > rect2 . right ) ; return result ; }
Returns true if the two elements or rectangles collide

@author   Jelle De Loecker   <jelle@develry.be>
@since    1.2.2
@version  1.2.2

@param    {HTMLElement}   element_one
@param    {HTMLElement}   element_two

@return   {Boolean}
Returns true if the two elements or rectangles collide