【问题标题】:fancyBox gallery link will not fire in IE inside prettyPhoto IframefancyBox 画廊链接不会在 PrettyPhoto Iframe 内的 IE 中触发
【发布时间】:2013-08-06 19:34:53
【问题描述】:

在我的 DotNetNuke 网站上,我创建了一个模块,该模块使用数据表来显示我的组织成员希望出售的一些商品。 ItemName 列是指向名为 ItemView.aspx 的 aspx 项目的链接,此页面包含有关从父页面上的该链接或 dnn 模块上的 ItemName 列填充的项目的详细信息。这是链接:

<td><p><a href="http://www.mysite.com/traderboard/ItemView.aspx?ItemName=<%# Eval("ItemName") %>&num=<%# Eval("num") %>&ImageAlt1=<%# Eval("ImageAlt1") %>&ImageAlt2=<%# Eval("ImageAlt2") %>&ImageAlt3=<%# Eval("ImageAlt3") %>?iframe=true&amp;width=800&amp;height=600" style="border: 0px currentColor;" rel="prettyPhoto[iframes]"><%# Eval("ItemName") %></a>

如果用户决定上传任何给他提供链接的图片,则在 ItemView 页面(在 prettyPhoto iframe 中拉出)上一次。

这是我用来在我的.aspx 文件中填充特定用户图像的 jQuery sn-p:

$("#hplImageTest").click(function () {
            $.fancybox.open([
                {
                    href: '<%=Image1%>',
                    title: 'My title'
                }, {
                    href: '<%=Image2%>',
                    title: '2nd title'
                }, {
                    href: '<%=Image3%>'
                }
            ], {
                helpers: {
                    thumbs: {
                        width: 75,
                        height: 50
                    }
                }
            });
        }); 

最后,我调用了位于ItemView 页面上的链接上的图像。

protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

            lblRow.Text = Request.QueryString["num"];
            PostPath1 = Request.QueryString["ImageAlt1"];
            PostPath2 = Request.QueryString["ImageAlt2"];
            PostPath3 = Request.QueryString["ImageAlt3"];

            Image1 = "http://www.mysite.com/" + PostPath1;
            Image2 = "http://www.mysite.com/" + PostPath2;
            Image3 = "http://www.mysite.com/" + PostPath3;
            string empty = "../images/tbimages/noImage.jpg";

            if ((PostPath1 == empty) && (PostPath2 == empty) && (PostPath3 == empty))
            {

                hplImageTest.Text = "No Images Available";

            }
            else
            {
                hplImageTest.NavigateUrl = "javascript:;";
                hplImageTest.Text = "Click here for Image(s)";
            }
        }
    }

它可以在 Firefox、Safari 和 Chrome 中运行,但在 IE 中什么也没有。有没有其他人遇到过这个问题?

【问题讨论】:

    标签: c# jquery fancybox-2 image-gallery prettyphoto


    【解决方案1】:

    我想通了。我的朋友向我指出,如果 iFrame 中调用的页面不在同一台服务器上,IE 将禁止在页面上触发链接。虽然两个页面都在同一台服务器上并且在相同的 DNN 安装下,但被调用的 URL 使用的 URL 与父页面不同。

    因此,由于单个 DNN 安装中的所有 URL 都指向我服务器上的同一个文件夹,我认为将 URL 更改为与父页面相同应该没有害处。

    一旦我改变了这个

    Image1 = "http://www.mysite.com/" + PostPath1;
    Image2 = "http://www.mysite.com/" + PostPath2;
    Image3 = "http://www.mysite.com/" + PostPath3;
    

    到这里:

    Image1 = "http://www.myparentsite.com/" + PostPath1;
    Image2 = "http://www.myparentsite.com/" + PostPath2;
    Image3 = "http://www.myparentsite.com/" + PostPath3;
    

    IE 开始工作了!我希望你们会发现这很有用!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-15
      • 1970-01-01
      • 1970-01-01
      • 2023-03-08
      • 1970-01-01
      • 2020-03-09
      • 1970-01-01
      • 2011-03-07
      相关资源
      最近更新 更多