I am seeking to develop a unique transparent overlay effect for a div that includes text. The objective is to have the overlay fade in and out upon activation by pressing a button. Traditionally, this can be achieved by placing a div within another div with absolute positioning and full width/height, adjusting the opacity using an ease or animation (Black transparent overlay on image).
However, I also require the ability to select the text within the div. Switching the overlay from
display: block
to
display: none
Will disrupt the fading animation. How can I smoothly transition from block to none so that I can recycle my underlying div?