I have an overlay+ spinner setup for a site I'm building and I want to set it up so that when someone clicks a link, the overlay and spinner come up.
However, quite a few of the pages are practically instant loads, so by time the overlay renders, the new page is ready so it's just a meaningless flicker that appears.
Here's what I have now. This fires the overlay for everything. I just want it to fire if it takes more than 2 seconds to render the next page.
Here's what I've found via googling, but this instead makes the overlay popup after 1 second of viewing the page... Any advise?
However, quite a few of the pages are practically instant loads, so by time the overlay renders, the new page is ready so it's just a meaningless flicker that appears.
Here's what I have now. This fires the overlay for everything. I just want it to fire if it takes more than 2 seconds to render the next page.
Code:
<script type="text/javascript">
$(document).ready(function() {
$('a').click( function() {
$(window).spin();}
);
});
</script>
Here's what I've found via googling, but this instead makes the overlay popup after 1 second of viewing the page... Any advise?
Code:
<script type="text/javascript">
$(document).ready(function() {
$('a').click(
setTimeout(function() {$(window).spin();}, 1000)
);
});
</script>
Last edited: