Skip to content

Instantly share code, notes, and snippets.

View MiniKielbyM's full-sized avatar
🏳️‍⚧️
:3

Phoebe Kielbasinski MiniKielbyM

🏳️‍⚧️
:3
View GitHub Profile
@MiniKielbyM
MiniKielbyM / mouseMovement.js
Created June 14, 2023 15:46
a mouse movement detector
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
}
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
)
}