Site introduction layer (float div)

Asked

Viewed 48 times

0

I need to find a solution where I open a layer to place advertising that automatically closes if the user doesn’t do anything.

Is there a script you can recommend?

I wonder if you could help me with that question?

  • 4

    This question seems to be decontextualized because it presents no research effort or previous attempts.

1 answer

1

You can use the function setTimeout. Take an example:

jQuery(function(){
  
  var itv = window.setTimeout(function(){
    
    jQuery("div.publicidade").fadeOut("fast", function(){ //ocultando a div da pagina com um efeito de fade
      jQuery("div.publicidade").remove(); //eliminando a div
      window.clearInterval(itv);
    });
    
  }, 3000); // delay de 3 segundos para executar a ação
  
});
div.publicidade{position:absolute; width: 200px; height: 200px; background: #efefef; border: 1px solid #ccc; top:100px; left: 100px;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="publicidade"></div>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.