I have the following code in javascript:
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(event) {
event.stopPropagation();
$("#img-loading").show();
$("button").prop("disabled", true);
clearTimeout(timeout);
var url = $(this).attr("url");
$(location).prop("href", url)
});
$("img").click(function(event) {
event.stopPropagation();
$("#img-loading").show();
$("button").prop("disabled", true);
clearTimeout(timeout);
var url = $(this).attr("url");
$(location).prop("href", url)
});
});
</script>
Basically what you do is, when you click on an image or a button, show an animated gif, clean a timeout variable that has the page and then redirect to the url that has the image or button associated with it. He clicked.
It works perfectly, but for some reason, there are times when it stops redirecting. That is, you click on an image or button, the animated gif is displayed and the timeout is cleared but it does not redirect to the page.
If it helps to find the solution, when I open the chrome development tools, the redirection works.
Any idea what could be wrong?
Thanks !!