Display Alert when element passes a certain left position?
<p>I have an element with a fixed position, it's animated with js and it's left position changes from 0 to 1000 randomly.</p>

<p>How can I display an alert each time the element crosses the 500px barrier?</p>

<p>I could only think of making an infinite loop that checks if leftpos &lt; 500px and then using a variable to store whether he is right or left and display the alert when the variable changes but it seems over complicated though maybe it's the only solution.</p>

<p>Is there a better solution to doing this?</p>
