So I have a div
element that gets animated when you hover over it. I want to detect when the div element leaves the point 0, 0
, and when it returns to 0, 0
. I have the base code already, I just don't know the variables I would plug in.
var divx = getElementById("div").position.x;
var divy = getElementById("div").position.y;
if (divx === 0 && divy === 0) {
window.alert("Div has returned to starting position")
And to finish off, I am just starting HTML and JavaScript, so if this is a super obvious solution, then I guess I'll have to go do more reasearch.