How to stop Jquery load function
- by Sergio
The Jquery load function don't stop if there is multiple click on the links in the menu.
The jquery code looks like:
$(document).ready(function(){
$(".menu_rfr").unbind("click").click(function() {
$("#main").html('<img src="img/spin.gif" class="spin">');
location.replace($(this).attr('rel'));
});
function handleClick() {
$(this).unbind("click");
$("#main").html('<img src="img/spin.gif" class="spin">');
$("#main").load($(this).attr('rel'), function() {
// reactivate it after some loading has completed
$(this).click(handleClick);
});
}
$(".menu_clickable").click(handleClick);
});
You can see the sample page at link text
How can I prevent users clicks if the DIV content is not loaded completely and never ending DIV loading?