jquery - Loading bar still running in Firefox if previous page is clicked -
i have progress 'bar' works fine in ie , chrome. when click on link or input button submit, progress 'bar' called via jquery. behaviour in firefox not expecting.
this script:
$("a, input[type=submit]").click( // http://heartcode.robertpataki.com/canvasloader/ function () { if ($(this).attr('target') == '_blank' || $(this).hasclass("noloadingbar")) { } else { var cl = new canvasloader('canvasloader-container'); cl.setdiameter(65); // default 40 cl.setdensity(50); // default 40 cl.setrange(0.8); // default 1.3 cl.setfps(29); // default 24 cl.show(); // hidden default // bit positioning - not necessary var loaderobj = document.getelementbyid("canvasloader"); loaderobj.style.position = "absolute"; loaderobj.style["top"] = cl.getdiameter() * -0.5 + "px"; loaderobj.style["left"] = cl.getdiameter() * -0.5 + "px"; } } )
when click on link in firefox, progress 'bar' loading, in ie , chrome. when click on previous button (previous page), progress 'bar' in firefox starting again.
how can make sure doesn't happen?
this trick, after leaving page, tell de progress bar stop.
$(window).unload(function(){ c1.stop(); });
will be:
$(document).on('click','a, input[type=submit]',function(){ // aan de hand van een klik de functie oproepen if ($(this).attr('target') == '_blank' || $(this).hasclass("noloadingbar")) {} else { var cl = new canvasloader('canvasloader-container'); cl.show(); // hidden default $(window).unload(function(){ // anders stop firefox niet als je pagina terug gaat c1.stop(); }); } });
Comments
Post a Comment