devc
devc

Reputation: 13

jquery prepend after body

I am trying this, to have content just after body tag.

  <script>jQuery(document).ready( function($) {
$('body').prepend('<h1>Hello World</h1>').hide().slideDown();
 } );</script>

I am able to see the content but animation is not working. please suggest where I am missing.

Upvotes: 1

Views: 725

Answers (1)

Richard Dalton
Richard Dalton

Reputation: 35793

Try:

$('<h1>Hello World</h1>').hide().prependTo('body').slideDown();

http://jsfiddle.net/infernalbadger/acU3q/

The problem is that you are calling hide() and slideDown() on the body tag rather than the newly created H1.

Upvotes: 2

Related Questions