This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function collide(div1ID, div2) { | |
const domRect1 = document.getElementById(div1ID).getBoundingClientRect(); | |
const domRect2 = div2.getBoundingClientRect(); | |
return!( | |
domRect1.top > domRect2.bottom || | |
domRect1.right < domRect2.left || | |
domRect1.bottom < domRect2.top || | |
domRect1.left > domRect2.right | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let m = false; | |
let id = 'example' | |
const Element = document.getElementById(id) | |
//add an 'onclick' listner with the MouseMove() function | |
function MouseMove() | |
{ | |
if(m==false) | |
{ | |
m=true | |
} |