So... This code works perfectly: http://bit.ly/1ONVMqQ (credit to this guy on this post)
I'm probably just really dumb, but is there a way that I can make it so that code displays a div when the divs touch instead of just a true/false output?
Thanks
Try this:
if (b1 < y2 || y1 > b2 || r1 < x2 || x1 > r2) {
$('#div3').hide();
}
else{
$('#div3').show();
}
if (b1 < y2 || y1 > b2 || r1 < x2 || x1 > r2) {
// todo if two div are separate
// hide div here
} else {
// todo if two div touch each other
// show div here
}