javascript - MVC How to add a delay on page load -
my question pretty simple(i think, cant find reference, wants slow down site,right?) , may sound ridiculous, trying have splash screen on page load of home/index of site. did @ top of page, added simple div splash , use javascript hide when page loaded.
$(window).bind("load", function () { // remove splash screen after load $('.splash').css('display', 'none') }) but problem is, home index loads fast (because plain text/html) hence splash screen shows .5 sec only. want add atleast 2-3 secs before removed, im assuming need add line or 2 of code in $(window).bind pause couple of secs before doing $('.splash').css('display', 'none') dont know or how it, please help! thank you!
you can use settimeout() delay things in javascript, this:
$(window).bind("load", function () { var delay = 5000; settimeout(function () { $('.splash').css('display', 'none'); }, delay); });
Comments
Post a Comment