I’m using visibility: hidden; and visibility: visible; to show and hive divs, such as modals and other divs. I’d like to have a fade-in effect when clicking the <a> link to run the javascript to show and hide the divs, but I’d very strongly like to continue using the visibility element to toggle the div visibility. Is there a way to do this with HTML/CSS/JavaScript/jQuery?
I’m using visibility: hidden; and visibility: visible; to show and hive divs, such as
Share
in jQuery:
With CSS, use opacity: (this is 50%)
If you would like to do the fadeIn manually, adjust this opacity in steps, and when you reach the point of invisibilty, add
display:noneBut if you use jQuery anyways, stick withfadeIn()fadeIn()supports speed too, just add the milliseconds as first parameter. Look at the docs: http://api.jquery.com/fadeIn/Want to keep the
displayproperty in css, usefadeTo(). It requires the opacity percentage: http://api.jquery.com/fadeto/