Let's say that I have a few divs on a page and I create a function that when the mouse cursor hovers over a div it changes it's color from 1 color to another in 2 seconds. So if I quickly hover over different divs the color changing effects take place simultaneously.
What I want is for any div to only change it's color AFTER the previous color transition is over. So If I hover over one div and then quickly hover over another one , the later will only change it's color once the color transition of the former ends.
I've tried a few things but none work. I guess it's due to the asynchronous nature of javasript?
Can you please give me a few pointers to where I should be looking at to learn how to create such functions?