首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在已加载的jquery页面中加载页面!

问在已加载的jquery页面中加载页面!
EN

Stack Overflow用户
提问于 2011-03-26 22:17:53
回答 1查看 258关注 0票数 0

我想知道是否可以使用jquery从已经加载的页面加载第二个页面,

我已经完成了加载第一页,在这种情况下,它是一个画廊,我可以加载所有我想要的图像作为拇指,现在我想要的是点击em和一个弹出窗口,将显示图像的细节,我也有弹出窗口的脚本,但当我组合弹出窗口与用jquery加载的画廊,弹出不工作。

代码语言:javascript
复制
<a href="detail.php?iid='.$iid.'" class="ajax"><img name="" style="margin:2px;" src="image.php?width=100&height=100&cropratio=2:2&amp;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的脚本。

代码语言:javascript
复制
$(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

EN

回答 1

Stack Overflow用户

发布于 2011-03-26 22:44:20

尝试使用.live() jquery api这里是文档http://api.jquery.com/live/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5442891

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档