I’m working on a quiz project. after giving answer when a user clicked the button I want to add a loading div for 5 second then redirect to win or lost page.Also let me know the css to cover whole screen.
below my code but this not working for 5 seconds…
<div id="spinner" style="display:none">
<img src="/sites/all/modules/custom/admin_job/assets/images/spinning-loading.gif">
</div>
<script>
$(document).ready(function() {
$('#edit-submit').click(function(){
$("#spinner").show();
setTimeout(function() { $("#spinner") }, 5000);
});
});
</script>
3
Answers
I believe that this is more along the lines of what you would like:
As I said in my comment you miss a
.hide()
in you timeout functionThis should do the trick. You can modify it accordingly to fit your need.