Jquery .show() not revealing a div with visibility of hidden
Reveal a div
with visibility: hidden
by changing the style to visibility: visible
.
.show()
changes display
, not visibility
, so it won't reveal an element made hidden
by visibility
.
Expanded approach: Unveiling the cloak of invisibility
Opacity fade-in: now you don’t see it
Some complex UI designs require smooth and subtle transitions. Try applying a gradual visibility change with fadeTo
:
This works well with elements styled with visibility: hidden
and opacity: 0
.
Using Classes for quick disguises
When you find yourself frequently toggling visibility
:
Swap visibility
in the blink of an eye:
Callbacks: planning the grand reveal
For complex animations, use callbacks with fadeOut
:
Unmasking the nuances: Avoid the pitfalls
Reserving stage space
Using visibility: hidden
maintains an element’s space in layout. When document flow is a key concern, pick visibility
over display
.
Browsers without CSS3? No problem!
Ensure all users enjoy a similar experience by offering alternatives:
Combined forces: Maximum effect
Partnering jQuery with CSS transitions grants granular control over element visibility transitions.
On-demand invisibility cloak
To enable dynamic interaction:
Was this article helpful?