Make a popup window last longer than 10 seconds

0

As the title says, I would like my popup to last longer, currently it does not last 10 seconds.

I leave my code:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!----POPUP ---->
<div id="palet1" style="display:none;">
    <h2 style="line-height: 2px;">titulo</h2>
    <p>bla bla bla</p>
    <div class="close _close" id="close">
        <a href=javascript:; class="btn_close_nuevo btn" onclick="SaveAndHide1(this)">Aceptar</a>
    </div>
</div>
<!---- POP UP---->

<!---- html ---->
<input type="radio" name="tipo-envio" id="A" value="P"> <font color="black" size="1px">Europeo</font> &nbsp
                <input type="radio" name="tipo-envio" id="B" value="P"> <font color="black" size="1px">Americano</font> &nbsp
                <input type="radio" name="tipo-envio" id="C" value="P"> <font color="black" size="1px">Otros</font>
        <a href="javascript:;" id="enviar_add_evento" class="btn btn-primary1 min-wide1" tabindex="13">BUSCAR</a>
<!----- HTML ----->

JAVASCRIPT

    $( "input" ).on( "click", function() { 
  if($('#A').is(":checked")){
    $('#enviar_add_evento').click(function(){
    document.getElementById('palet1').style.display="block";
    });
  }else if($('#B').is(":checked")){
    $('#enviar_add_evento').click(function(){
    document.getElementById('palet1').style.display="block";
    });
  }else if($('#C').is(":checked")){
    $('#enviar_add_evento').click(function(){
    document.getElementById('palet1').style.display="block";
    });
  }else{
        //* nothing to do
  }
});

/// funcion para cerrar el cuadro del popup
    function SaveAndHide1(star) {
        palet1.style.display = "none";
    }

CSS

/* alerta palets */
#palet1 {
position: fixed;
    bottom: 50%;
    left: 25%;
    border: 1px solid #ddd;
    padding: 20px 25px 3px 25px;
    background: white;
    color: grey;
    font-size: 10px;
    z-index: 10000;
    width: 358px;
    height: 200px;
    text-align: justify;
    text-decoration: none;
}

#palet1 a {
color:white;
text-decoration: none;
}

#palet1 a:hover {
text-decoration: none;
}

#palet1 .close {
cursor: pointer;
    padding: 10px;
    position: absolute;
    top: 140px;
    right: 59px;
    text-align: right;
}
/* alerta palets */
    
asked by Eduardo Leon 08.08.2018 в 05:43
source

1 answer

0

I recommend that you read the documentation of setTimeout () , it is an event Very simple to use and you can apply it in a lot of situations.

I leave you an example so that you can interpret its operation and apply it to your specific problem.

  function funcionInstantanea()
  {
    console.log("Listo.");
  }
  function funcionConDemora(){
      
    setTimeout(function(){

        console.log("Listo tras 10 segundos.");

    },10000);
  }
<button onclick="funcionInstantanea()">Ejecución Instantánea</button>
<br>
<button onclick="funcionConDemora()">Ejecución con demora</button>

I hope you understand, greetings!

    
answered by 08.08.2018 / 06:00
source