2
Good people, it may seem simple and easy to solve. But for those who do not understand anything of the language, it ends up being a torment. Come on:
I created a modal window containing a warning image. And it includes the div’s with the respective id’s in html:
<div id="fundo">
<div class="janelamodal">
<img src="aviso.png" title="Aviso Vapores e Sabores" alt="Vapores e Sabores" />
<div class="fecharmodal">
<a href="#home" title="Fechar">
<img src="closebutton.png" alt="Fechar" title="Fechar" border="0" />
</a>
</div>
</div>
This modal is hidden and appears after 3 seconds. It follows CSS and Javascript:
In the CSS
*{margin:0; padding:0;}
#fundo{
width:100%;
height:100%;
background:url(fundo.png);
position:fixed;
top:0;
left:0;
display:none;
}
#fundo .janelamodal{
width:350;
height:260px;
position:absolute;
left:50%;
top:50%;
margin-left:-175px;
margin-top:-130px;
padding:5px;
background:#FFF;
border-radius:4px;
}
#fundo .fecharmodal{
position:absolute;
right:-11px;
top:-11px;
}
In javascript
$(document).ready(function(){
setTimeout(function(){
$("#fundo").fadeIn();
$(".fecharmodal").click(function(){
$("#fundo").fadeOut();
});
}, 3000);
});
I referenced the close button, including the hash #home
and my idea would be, if possible, to do a hash search on the url and if you have this hash, not to display the modal window to the visitor again. So you don’t get bored browsing the site. Then the window would only appear if the session was closed.