I'm developing a web application using Html, CSS, Jquery, and every time the page is loaded a modal appears with an image.
ButwhenIclickthecloseicontheimageexitsbutthebackgroundcolordoesnot.
HTML
<divid="boxes">
<div id="dialog" class="window">
<a href="#" class="close">x</a><br />
<!-- Adicione o nome da imagem aqui -->
<img width="300" src="imagens/bolos.JPG" border="0">
</div>
<!-- Máscara para cobrir a tela -->
<div id="mask"></div>
</div>
JS
<script type="text/javascript">
$(window).load(function() {
$('#dialog').modal('show');
});
$( "#close" ).click(function() {
$("#mask").css("display", "none");
});
$(document).ready(function() {
$('a[name=modal]').click(function(e) {
e.preventDefault();
var id = $(this).attr('href');
var maskHeight = $(document).height();
var maskWidth = $(window).width();
$('#mask').css({'width':maskWidth,'height':maskHeight});
$('#mask').fadeIn(1000);
//Escolha a opacidade do fundo
$('#mask').fadeTo("slow",0.8);
//Obeter o tamanho da janela
var winH = $(window).height();
var winW = $(window).width();
$(id).css('top', winH/2-$(id).height()/2);
$(id).css('left', winW/2-$(id).width()/2);
$(id).fadeIn(1000);
});
$('.window .close').click(function (e) {
e.preventDefault();
$('#mask').hide();
$('.window').hide();
});
$('#mask').click(function () {
$(this).hide();
$('.window').hide();
});
});
CSS
<style type="text/css">
a {color:#333; text-decoration:none}
a:hover {color:#ccc; text-decoration:none}
#mask {
position:absolute;
left:0;
top:0;
z-index:9000;
background-color:#aaa2a2;
display:none;
}
#boxes .window {
position:absolute;
left:0;
top:0;
width:0px;
height:0px;
display:none;
z-index:9999;
padding:20px;
}
#boxes #dialog {
position:absolute;
width:675px;
height:453px;
padding:10px;
left: 80%;
}
.close{
color: #FFF;
font-family: sans-serif;
padding-top: 4px;
right: 50%;
}
</style>
Error.