Organizational Research By

Surprising Reserch Topic

Question:jQuery, display loading page div only if the page takes more than 2 seconds to load



asked Sep 13, 2013 in jquery by anonymous
edited Sep 12, 2013
0 votes
20 views



Related Hot Questions

2 Answers

0 votes
$(document).ready(function() { $('#page_loading').slideDown(500); }); jQuery(window).load(function () { setTimeout(function() {$('#page_loading').slideUp(500);}, 1500); }); What I am I trying to achieve: When browsing thorough the 4 pages, have the #page_loading div slide down only if the page takes more than 2 seconds to load. If the pages takes less than 2 seconds to load (was visited before and most of the images are cached) then the loading div won't show up. At this point, even if the page takes less than one second to load that loading div still appears and disappears, and it's pretty annoying.
answered Sep 13, 2013 by anonymous
edited Sep 12, 2013
0 votes
$(document).ready(function() { $('#page_loading').slideDown(500); }); jQuery(window).load(function () { setTimeout(function() {$('#page_loading').slideUp(500);}, 1500); }); What I am I trying to achieve: When browsing thorough the 4 pages, have the #page_loading div slide down only if the page takes more than 2 seconds to load. If the pages takes less than 2 seconds to load (was visited before and most of the images are cached) then the loading div won't show up. At this point, even if the page takes less than one second to load that loading div still appears and disappears, and it's pretty annoying.
answered Sep 13, 2013 by anonymous
edited Sep 12, 2013

...