我想知道是否可以使用jquery从已经加载的页面加载第二个页面,
我已经完成了加载第一页,在这种情况下,它是一个画廊,我可以加载所有我想要的图像作为拇指,现在我想要的是点击em和一个弹出窗口,将显示图像的细节,我也有弹出窗口的脚本,但当我组合弹出窗口与用jquery加载的画廊,弹出不工作。
<a href="detail.php?iid='.$iid.'" class="ajax"><img name="" style="margin:2px;" src="image.php?width=100&height=100&cropratio=2:2&image=/u/'.$file.'" alt="" /></a>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function (){
$('a.ajax').click(function() {
var url = this.href;
var dialog = $('<div style="display:hidden"></div>').appendTo('body');
// load remote content
dialog.load(
url,
{},
function (responseText, textStatus, XMLHttpRequest) {
dialog.dialog();
}
);
//prevent the browser to follow the link
return false;
});
});
</script>正如你所看到的,detail.php通过url属性获取图像i,当我使用它作为直接的gallery.php时,这是有效的,只有当我通过index.php使用jquery加载gallery.php时,问题才会出现。
下面是使用index.php文件加载gallery.php的脚本。
$(document).ready(function()
{
$("#gl").click(function()
{
//$(this).text("...One Moment Please...");
$("#container").append('<div id="glr" "></div>')
.children("#glr").hide()
.load("gallery.php div#glr", function()
{
$("#tet").remove();
$("#rem").remove();
$("#glr").slideDown("slow");
});
return false;
});
}); 正如你在下面的图片中看到的,当我直接转到gallery.php时,它是有效的。
http://i.stack.imgur.com/Gyf4A.png
这是在使用jquery通过index.php加载时的gallery.php。
http://i.stack.imgur.com/oqVce.png
我不会在加载gallery.php时弹出detail.php。
任何反馈都将非常感谢,
ThankYou M.Amin
发布于 2011-03-26 22:44:20
尝试使用.live() jquery api这里是文档http://api.jquery.com/live/
https://stackoverflow.com/questions/5442891
复制相似问题