If you have spent any time developing with jQuery, there is no doubt that you will come across a key issue when working with animations: how many times have you seen a browser cycle through multiple queued animations when you switch to another browser window and back again?
I can bet that the answer is quite a few times; the key to this issue boils down to jQuery queuing all the animations it has been asked to perform. If too many initiations take place, then jQuery's animation queue becomes confused and hence it seems to go crazy! Let's take a look at the issue in action before working through a simple fix for the problem:
Start by extracting the
blockedqueue.html
andblockedqueue.css
files from the code download that accompanies this book—they will provide some simple markup to illustrate our queuing issue.In a text editor, add the following to a new file, saving it as
blockedqueue.js
in thejs
subfolder of our project area:$(document).ready(function...