我有一个 index page index.php
,当用户点击一个项目时(为了这个问题,假设该项目包含在一个名为 的 html 页面上aeffect.html
),它加载aeffect.html
到一个 div 中:
<div id="popupContainer"></div>
它包含在 oncontained on 上index.php
。
不过,上面有很多项目index.php
,每个项目都有一个关闭按钮。我试图使用这个变量来清空popupContainer
,希望它将它重置为空,然后aeffect.html
消失。
//Close property
$("a.close").click(function(){
$("#popupContainer").empty();
});
这似乎不起作用,我不完全确定如何使这项工作。有没有办法让它的动作aeffect.html
可以控制 div index.php
?
这是完整的jquery:
$(document).ready(function() {
//Find & Open
$(".projectThumb").click(function(){
$("#popupContainer").load("/aeffect.html");
});
//Close property
$("a.close").click(function(){
$("#popupContainer").empty();
});
});
这是 index.php 的 html
<div id="container">
<div class="projectThumb">
<img src="/img/aeffect_button_static.gif" width="146" height="199" class="button" name="aeffect" alt="" />
<p class="title">A.EFFECT: Film Poster</p>
</div>
</div>
<div id="popupContainer"></div>
和 aeffect.html 的 html
<div class="projectPopup" id="aeffect">
<a class="close">Close ×</a>
<img src="/img/aeffect_popup.jpg" width="500" height="729" alt="" />
<p class="description">Description</p>
</div>