Jump to content
Stef's Coding Community
Sign in to follow this  
antpower26

Jquery fadeIns

Recommended Posts

Hi

I am just coding in jquery for the first time :script type="text/javascript">

 

$(document).ready(function(){

$("#appearingduo").fadeIn('slow', function () {

// fade has finished

});

});

</script>

</head>

The syntax is a little confusing, for that reason. on my current build I am trying to fade in an image, it is working, but I would like the fade in to slow down to

say around 2 seconds, I am having trouble making this happen, please help:))))

 

 

Ant

Share this post


Link to post
Share on other sites

The jquery documentation is pretty helpful for this sort of thing: http://api.jquery.com/fadeIn/

 

To adjust the speed, change 'slow' to a number of milliseconds:

 

<script type="text/javascript">
$(document).ready(function(){
  $("#appearingduo").fadeIn(2000, function () {
  // fade has finished
  });
});
</script>

Also, keep in mind that if you don't need any sort of javascript action after the fade has finished, you can drop the "function()" section like this:

 

<script type="text/javascript">
$(document).ready(function(){
  $("#appearingduo").fadeIn(2000);
});
</script>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...