In the below code, I am toggling visibility of a div (id=popdiv) on click of a button. I want to add some transition effect to it. For example, right now it just pops up and hides. I want the transition to be a little slow while showing hiding but none of the transition or animation effects are working.
$('#pop').click(function(){
$('#popdiv').toggle();
})
#popdiv{
display: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div style="background-color: aqua; width: 50%; height: 20%;" >
<button id="pop">CLICK</button>
</div>
<div style="background-color: cadetblue; width: 30%; height: 40%;" id="popdiv">
POPUP
</div>
How to achieve this ?
Thanks in advance !