0

I have been trying to get the jQuery to animate the loading of my page. I have proved that jQuery is working correctly because it works with .hide();

Here is my JSFiddle

Here is my JavaScript File

$(document).ready(function(){
  $(".intro").show();
});
Tom Eaton
  • 23
  • 8

3 Answers3

0

It is because you have this is your CSS:

.intro {
    visibility: hidden;
}

To fix this, change your CSS to:

.intro {
    display: none;
}

OR

Change the JS:

$(document).ready(function(){
    $(".intro").css('visibility', 'visible');
});

The jQuery .show() method sets the style of an element to display: block; but ignores the visibility style. The .hide() method essentially adds display: none; to an element.

Here is a good related question.

Community
  • 1
  • 1
Jamie Dunstan
  • 3,725
  • 2
  • 24
  • 38
0

use

display: none;

instead of

visibility: hidden;

for the class .intro in your css.

Here is the working fiddle.

Mithun Satheesh
  • 27,240
  • 14
  • 77
  • 101
0

In your css, you are setting visibility: hidden;. Change it to display:none.

Because .show() is basically doing display:block.

OR

Change the code like this $(".intro").css("visibility","visible")

Fiddle

Anoop Joshi P
  • 25,373
  • 8
  • 32
  • 53