Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery, Showing a hidden item with a fadeIn

Tags:

in jquery, how can I show a hidden div, and make it fade in?

like image 256
Blankman Avatar asked Jun 07 '10 19:06

Blankman


People also ask

What is the difference between fadeOut and hide in jQuery?

fadeOut() the place will be removed at once. . show(duration) and . hide(duration) animate the size of element (also the opacity) to 100% and 0% and the place of elements is also animated in that duration.

What is fadeIn and fadeOut in jQuery?

The fadeIn method displays the element by fading it to opaque. The fadeOut method hides the element by fading it to transparent. Note – jQuery does the fading by changing the opacity of the element.

What is fadeIn in jQuery?

The fadeIn() Method in jQuery is used to change the opacity of selected elements from hidden to visible. The hidden elements will not be display. Syntax: $(selector).fadeIn( speed, easing, callback )


1 Answers

Just hide the element initially, ether with .hide() or style="display: none;" (or display: none; in the stylesheet). Then, just call .fadeIn(), like this:

$("#elementID").fadeIn(); 

The .fadeIn() call automatically removes the display: none when it fades the opacity to 100%, it won't remove visibility: hidden; so don't use this, or you'll have to remove it manually.

like image 150
Nick Craver Avatar answered Oct 04 '22 15:10

Nick Craver