Currently I have something setup where a user clicks on an image and based off that image, a div will fade in / fade out.
If the user goes crazy and clicks on a bunch of the images at the same time, multiple divs load rather than just the last requested one.
I've tried to illustrate my problem here. http://jsfiddle.net/BBgsf/
Clicking on any of those images will load the corresponding div with the number. But if you click on different images before the animation is completed, it loads the other divs as well.
jQuery
$(".flow-chart img").click(function () {
var div_class = $(this).data("class");
$(".hide_show:visible").fadeOut('slow', function() {
$("."+div_class).fadeIn("slow");
});
});
HTML
<div class="1 hide_show">1</div>
<div class="2 hide_show" style="display: none">2</div>
<div class="3 hide_show" style="display: none">3</div>
How can I prevent the multiple divs from loading rather than just one at a time?