遇到Fancybox的问题(P. [英] Having problems with Fancybox (P

查看:103
本文介绍了遇到Fancybox的问题(P.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Fancybox添加到我的ASP.NET MVC应用程序中,但我遇到了一些麻烦。

I'm trying to add Fancybox to my ASP.NET MVC application but I'm having some troubles.

如您所见,我添加了对jQuery和Fancybox的引用。 css被包含在我的style.css中。并且所有图片都在正确的位置。

As you can see, I added references to jQuery and Fancybox. The css is incapsulated inside of my style.css. And all the pictures are in the right place.

<link rel="stylesheet" href="/Content/style.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="/Scripts/jquery.fancybox-1.2.6.pack.js"></script>

好吧,我添加了这些行来启动Fancybox插件:

Well, I added this lines to fire up the Fancybox plugin:

<script type="text/javascript">

    $(document).ready(function() {
        $("a.zoom").fancybox(); // The a with zoom class
    });

</script>

然后我有链接:

<a class="zoom" href="http://www.nytimes.com">This goes to iframe</a>

但是当我点击链接时,我得到一个:Microsoft JScript运行时错误:权限被拒绝
替代文字http://img265.imageshack.us/img265/7738/screenshot20091123at352.png

But when I click on the link I get a: Microsoft JScript runtime error: Permission denied alt text http://img265.imageshack.us/img265/7738/screenshot20091123at352.png

这是我的屏幕之后:
替代文字http://img14.imageshack.us/img14/7738/screenshot20091123at352.png

I不知道该怎么办。我很绝望,因为我整天都在努力弄清楚发生了什么。请帮忙! :)

I don't know what to do. I'm desperate because I've spent all my day trying to figuring out what's happening. Please, help! :)

推荐答案

您需要在链接中添加iframe类,告诉fancybox使用iframe加载内容避免与同源政策发生冲突。相同的源策略阻止浏览器通过AJAX下载外部内容。或者,您似乎可以在URL中添加?iframe 参数并获得相同的效果。

You need to add the class 'iframe' to the link to tell fancybox to use an iframe to load the content to avoid a conflict with the same origin policy. The same origin policy prevents the browser from downloading external content via AJAX. Alternatively it appears you can add a ?iframe parameter to the URL and achieve the same effect.

这篇关于遇到Fancybox的问题(P.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆