The function isn't actually meant to be called by itself - the code above adds it as an event listener for clicks. So whenever a click is detected on the page, the function executes. I'm assuming...
Hey Kirby - thanks for the reply! I've been playing around with the code you suggested and it seems to be working pretty well, definitely haven't found any better alternatives. I've noticed that...