/    Sign up×
Community /Pin to ProfileBookmark

Displaying a gif before a page loads for a fixed amount of seconds

Hi all,

I want to implement this on my website: [url]http://article.onlinewebtool.com/showing-a-loading-gif-image-while-a-page-loads-using-javascript-and-css/[/url]

However, I don’t want the loading gif to just display until the page loads. I want the gif to display for a fixed amount of time.

So, for example, if I want that loading gif to display for 15 seconds before the page is displayed, how do I do that?

Thanks.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@kromolSep 22.2012 — Use setTimeout and call the function that shows content and hides loader in setTimeout, not in window.onload.
×

Success!

Help @DanCorb spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...