Gautham
Gautham

Reputation: 3

How do I run a loading animation before page load

Exactly like this one - http://www.solasie.com/en/. Also I want the animation to load every time and just not the first time.

Here are the related questions.

Display an animation while loading a page using JQuery and

How to load animated gif before Flash load

EDIT 1

I tried using the following code. Its showing an error.

<html >
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<title>Page Title</title>
</head>
<body>
<div id="loading">
<img src="counting30ll6.gif" > 
</div>
<script type="text/javascript">
  $(window).load(function(){
  $('#loading').delay(10000).queue(function(){ $(this).hide();$(this).dequeue(); });
</script>
</body>
</html>

Upvotes: 1

Views: 5908

Answers (1)

Felipe Miosso
Felipe Miosso

Reputation: 7339

In fact, this animation is running after the page loads. Wrap all your animation code into a function and then bind it on onLoad event. This will make the impression that you want.

EDIT Here is a little jsfiddle that might give you some direction.

jsfiddle.net/gBspY/

Upvotes: 1

Related Questions