我设法使用 simplemodal 插件让多个模态窗口工作,但我需要能够在它们之间切换而无需用户先手动关闭它。
在这一点上,我仍在通过示例学习这一点。我已经看到了一些关于这个问题的其他参考资料,但是所提供的解决方案要么不起作用,要么没有从相同的构建块开始。
非常感谢任何提示或建议。
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SimpleModal</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type='text/javascript' src='js/jquery.simplemodal.js'></script>
<script>
jQuery(function ($) {
$('#basic-modal .link1').click(function (e) {
$('#link1-modal-content').modal();
return false;
});
$('#basic-modal .link2').click(function (e) {
$('#link2-modal-content').modal();
return false;
});
$('#basic-modal .link3').click(function (e) {
$('#link3-modal-content').modal();
return false;
});
});
</script>
<style>
#simplemodal-overlay {background-color:#000; cursor:wait;}
</style>
</head>
<body>
<!-- MAIN PAGE / LINKS TO MODAL WINDOWS-->
<div id='basic-modal'>
<a href="#" class="link1" id="pop1">Link to Content 1</a><br />
<a href="#" class="link2" id="pop2">Link to Content 2</a><br />
<a href="#" class="link3" id="pop3">Link to Content 3</a><br />
</div>
<!-- INDIVIDUAL MODAL WINDOWS CONTENT -->
<div id="link1-modal-content" style="display:none; width:200px; height:200px; background-color:#FFFFFF;">
<p>Content 1</p>
Content 1<br />
<a href="#" class="link2" id="pop2">Link to Content 2</a><br />
<a href="#" class="link3" id="pop3">Link to Content 3</a><br />
</div>
<div id="link2-modal-content" style="display:none; width:200px; height:200px; background-color:#FFFFFF;">
<p>Content 2</p>
<a href="#" class="link1" id="pop1">Link to Content 1</a><br />
Content 2<br />
<a href="#" class="link3" id="pop3">Link to Content 3</a><br />
</div>
<div id="link3-modal-content" style="display:none; width:200px; height:200px; background-color:#FFFFFF;">
<p>Content 3</p>
<a href="#" class="link1" id="pop1">Link to Content 1</a><br />
<a href="#" class="link2" id="pop2">Link to Content 2</a><br />
Content 3<br />
</div>
</body>
</html>