Is there an alternative to fadeOut() that doesn't use display:none for the style? I'd like to just use visibility hidden to avoid any sort of shifting in the page layout?
Is there an alternative to fadeOut() that doesn't use display:none for the style? I'd like to just use visibility hidden to avoid any sort of shifting in the page layout?
You can use .animate()
on the opacity
directly:
$(".selector").animate({ opacity: 0 })
This way the element still occupies space like you want, it just has a 0
opacity, so it's effectively the same as it being visibility: hidden
when it finishes.