0

I'm in the process of making a website. I found this link to create a spinning animation.

CSS3 Rotate Animation

I want to be able to display this animation for 4s and then have it fade to the website. I only have knowledge in html and css so it would be great if someone could please help me.

2 Answers2

0

$(document).ready(function(){$("body").hide().fadeIn(1000);});

James P.
  • 16
  • 7
0

I'm not entirely sure what you're looking for hear but my best guess is that you want to use the answer from that question you linked as a loading image in front of a website and you want the image to fade out and the website to fade in after a specified length of time.

To perform an action after a specified length of time you use

setTimeout(function, duration)

Documentation on setTimeout

To hide/show the image/website respectively you can use something like this:

function(){
  document.getElementById("content").style.display = "block";
  document.getElementById("loading").style.display = "none";
}

Then you combine them into this:

setTimeout(function() {
  document.getElementById("content").style.display = "block";
  document.getElementById("loading").style.display = "none";
}, 4000);

You can also jQuery to be able to animate the transition:

setTimeout(function() {
  $("#content").show(1000);
  $("#loading").hide(1000);
}, 4000);

And here's a jsFiddle that demonstrates that it works.

Mark Kramer
  • 3,134
  • 7
  • 34
  • 52