Auto Hide the Element Or Div In website after few second According to given time.

When we want to hide some div or Html Element After some time we can use the below code

Example

HTML

<div id=”hideDiv”>
  This div will hide automatically after 5 seconds
</div>

CSS

#hideDiv{background:red; width:400px; 

margin:0 auto; color:#fff; padding:10px; 

text-align:center;}

JS

$(function() {
setTimeout(function() { $(“#hideDiv”).fadeOut(1500); }, 5000)

})

Note: The Above code is for reference only we can change the code According to our need.

Leave a comment

Your email address will not be published. Required fields are marked *