Oscar
Oscar

Reputation: 3

Auto show div after few seconds javascript

I just want a simple div that contains some images to show after a certain amount of seconds or minutes. im using a basic bootstrap site.

Upvotes: 0

Views: 1556

Answers (2)

Asifuzzaman
Asifuzzaman

Reputation: 1783

Hello Try the below code Hope It Helps

  <script type="text/javascript"> 
    $(document).ready( function() {
    $('#divname').delay(1000).fadeIn();
   });
  </script>

and the css

 #divname
  {
  background-image: url("mm.jpg");
  width:400px;
  height:400px;
  display:none;

   }

Upvotes: 0

JC Hern&#225;ndez
JC Hern&#225;ndez

Reputation: 807

Try this: https://jsfiddle.net/L9fe0py3/6/

I used jQuery

HTML:

<div id="thisDiv" style="display:none;">
<img src="http://bxslider.com/images/home_slides/hillside.jpg" style="width:100%;height:100%"/>
</div>

Javascript:

$(document).ready(function() {
setTimeout(function(){
$('#thisDiv').fadeIn();
}, 2000);
});

Upvotes: 1

Related Questions