Good people, it may seem simple and easy to solve. But for those who do not draw anything from the language, it ends up becoming a torment. Come on:
I created a modal window containing a warning image. And include the div's with their id's in the 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 mode is hidden and appears after 3 seconds. Follow CSS and Javascript:
In 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;
}
No javascript
$(document).ready(function(){
setTimeout(function(){
$("#fundo").fadeIn();
$(".fecharmodal").click(function(){
$("#fundo").fadeOut();
});
}, 3000);
});
I made reference to the close button, including the hash #home
and my idea would be, if possible, to search the hash in the url and if it has that hash, do not display the modal window for the visitor again. So do not be boring to navigate the site. Then the window would only appear if the session was closed.