0

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

Community
  • 1
  • 1
meowsome
  • 77
  • 1
  • 9

2 Answers2

0

Try this:

 if (b1 < y2 || y1 > b2 || r1 < x2 || x1 > r2) {
    $('#div3').hide();
 }
 else{
    $('#div3').show();
 }

JSFIDDLE DEMO

RockMyAlgorithm
  • 516
  • 1
  • 4
  • 14
0
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
}
augustine
  • 538
  • 4
  • 15