I'm using jQuery. I need a div to fade in when the page loads.
<div id=monster></div>
How can I achieve this?
The jQuery fadeIn() method is used to fade in a hidden element. Syntax: $(selector).fadeIn(speed,callback);
jQuery fadeIn() Method The fadeIn() method gradually changes the opacity, for selected elements, from hidden to visible (fading effect). Note: Hidden elements will not be displayed at all (no longer affects the layout of the page).
See working demo
$('#monster').hide().fadeIn('slow');
#monster{
width: 200px;
height: 100px;
border: 1px solid #0095ff;
border-radius: 5px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id=monster>
<pre>
This is demo text.
This is demo text.
This is demo text.
This is demo text.
</pre>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With