No he conseguido distinguir entre las dos ventanas modal, con el siguiente código me abre las dos a la vez.
index.php
Código HTML:
Ver original<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="estilo.css" type="text/css" media="screen" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript"> var popupStatus = 0;
function loadPopup() {
if (popupStatus == 0) {
$("#backgroundPopup").css({
"opacity": "0.7"
});
$("#backgroundPopup").fadeIn("slow");
$("#popupContact1").fadeIn("slow");
$("#popupContact2").fadeIn("slow");
popupStatus = 1;
}
};
function disablePopup() {
if (popupStatus == 1) {
$("#backgroundPopup").fadeOut("slow");
$("#popupContact1").fadeOut("slow");
$("#popupContact2").fadeOut("slow");
popupStatus = 0;
}
};
$(document).ready(function () {
$("#button1, #button2").click(function () {
loadPopup();
});
$("#popupContactClose").click(function () {
disablePopup();
});
$("#backgroundPopup").click(function () {
disablePopup();
});
$(document).keypress(function (e) {
if (e.keyCode == 27 && popupStatus == 1) {
disablePopup();
}
});
});
<a href="#" id="button1">MODAL BOX #1
</a> <a href="#" id="button2">MODAL BOX #2
</a>
<!-- Contenido POP-UP #1 -->
<!-- Contenido POP-UP #2 -->
<div id="backgroundPopup"></div>
estilo.css
Código CSS:
Ver original/* reset */
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em,
font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody,
tfoot, thead, tr, th, td {
border: 0pt none;
font-family: inherit;
font-size: 100%;
font-style: inherit;
font-weight: inherit;
margin: 0;
padding: 0;
vertical-align: baseline;
}
/* fin reset */
body {
background: #fff none repeat scroll 0%;
line-height: 1;
font-size: 12px;
font-family: arial,sans-serif;
margin: 0;
height: 100%;
}
a {
cursor: pointer;
text-decoration:none;
}
br.both{
clear:both;
}
#backgroundPopup{
display: none;
position: fixed;
_position: absolute; /* necesario para internet explorer 6 */
height: 100%;
width: 100%;
top: 0;
left: 0;
background: #ccc;
border: 1px solid #cecece;
z-index: 1;
}
#popupContact1{
display: none;
position: fixed;
_position: fixed; /* necesario para internet explorer 6*/
width: 420px;
height: 370px;
margin-top: -205px;
margin-left: -210px;
top: 50%;
left: 50%;
background: #FFFFFF;
border: 12px solid #cecece;
z-index: 2;
padding: 12px;
font-size: 13px;
}
#popupContact2{
display: none;
position: fixed;
_position: fixed; /* necesario para internet explorer 6*/
width: 100px;
height: 100px;
margin-top: 0px;
margin-left: 0px;
top: 50%;
left: 50%;
background: yellow;
border: 12px solid #cecece;
z-index: 2;
padding: 12px;
font-size: 13px;
}
#popupContactClose {
font-size: 14px;
line-height: 14px;
right: 6px;
top: 4px;
position: absolute;
color: #800000;
font-weight: 700;
display: block;
}
#button1,#button2{
text-align: left;
font-size: 13px;
cursor: pointer;
width: 100px;
margin: 0 auto;
margin-top: 10px;
}
¿Alguna idea?
Muchas gracias de antemano