Fancybox 2.0 未在本地主机上加载

发布于 2025-01-05 04:17:28 字数 2592 浏览 1 评论 0原文

我正在使用 Dreamweaver CS5 开发一个网站,并且尝试在 Dreamweaver cs5 上加载 Fancybox 2.0.4,同时使用实时视图在我的本地主机上开发该网站,但无济于事。此外,Fancybox 不会使用任何浏览器(Safari、Firefox、Chrome、Opera)在同一本地主机环境中加载。但是,当我将页面加载到远程网站时,我可以完美地工作。我在 MAC OS X Lion 上使用 MAMP 作为本地主机服务器。我已经绞尽脑汁好几个星期了,还没有找到解决办法。任何帮助将不胜感激。下面是我正在使用的代码副本(从 fancybox 网站复制用于测试目的),该副本测试了我的理论,即 fancybox 在远程服务器上工作时无法在本地主机上工作,具有相同代码工作的网站是 http://www.gabrielelopez.com/Untitled-1.html

预先感谢您的任何帮助,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1  /DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>


<!-- Add jQuery library -->
<script type="text/javascript" language="JavaScript" src="fancybox/lib/jquery-1.7.1.min.js"> </script>

<!-- Add mousewheel plugin (this is optional) -->
<script type="text/javascript" language="JavaScript" src="fancybox/lib/jquery.mousewheel-    3.0.6.pack.js"></script>

<!-- Add fancyBox main JS and CSS files -->
<script type="text/javascript" language="JavaScript" src="fancybox/source/jquery.fancybox.pack.js"></script>

<link rel="stylesheet" type="text/css" href="fancybox/source/jquery.fancybox.css" media="screen" />

<!-- Add fancyBox - button helper (this is optional) -->
<link rel="stylesheet" type="text/css" href="fancybox/source/helpers/jquery.fancybox-buttons.css" />

<script type="text/javascript" language="JavaScript" src="fancybox/source/helpers/jquery.fancybox-buttons.js"></script>

<!-- Add fancyBox - thumbnail helper (this is optional) -->
<link rel="stylesheet" type="text/css" href="fancybox/source/helpers/jquery.fancybox-thumbs.css" />
<script type="text/javascript" language="JavaScript" src="fancybox/source/helpers/jquery.fancybox-thumbs.js"></script>

<script type="text/javascript">
$(document).ready(function() {
$(".various").fancybox({
    maxWidth    : 800,
    maxHeight   : 600,
    fitToView   : false,
    width       : '70%',
    height      : '70%',
    autoSize    : false,
    closeClick  : false,
    openEffect  : 'none',
    closeEffect : 'none',
    type : 'iframe',
});
});
</script>
</head>

<body>


<a class="various fancybox.iframe" href="http://www.youtube.com/embed/L9szn1QQfas?autoplay=1">Youtube (iframe)</a>

I'm working on a website using Dreamweaver CS5 and I'm trying to load Fancybox 2.0.4 on dreamweaver cs5 while working on the website on my localhost using Live view to no avail. In addition Fancybox will not load in the same localhost environment using any browser (Safari, Firefox, Chrome, Opera). However, when I load the page to the remote website ti works perfectly. I'm using MAMP as my localhost server on MAC OS X Lion. I have been banging my head for weeks and have not found a solution. Any help will be appreciated. Below a copy of the code I'm using (copied from the fancybox website for testing purposes) that tested my theory that fancybox is not working on localhost while it works on remote server, the website with the same code working is http://www.gabrielelopez.com/Untitled-1.html

Thank you in advance for any help,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1  /DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>


<!-- Add jQuery library -->
<script type="text/javascript" language="JavaScript" src="fancybox/lib/jquery-1.7.1.min.js"> </script>

<!-- Add mousewheel plugin (this is optional) -->
<script type="text/javascript" language="JavaScript" src="fancybox/lib/jquery.mousewheel-    3.0.6.pack.js"></script>

<!-- Add fancyBox main JS and CSS files -->
<script type="text/javascript" language="JavaScript" src="fancybox/source/jquery.fancybox.pack.js"></script>

<link rel="stylesheet" type="text/css" href="fancybox/source/jquery.fancybox.css" media="screen" />

<!-- Add fancyBox - button helper (this is optional) -->
<link rel="stylesheet" type="text/css" href="fancybox/source/helpers/jquery.fancybox-buttons.css" />

<script type="text/javascript" language="JavaScript" src="fancybox/source/helpers/jquery.fancybox-buttons.js"></script>

<!-- Add fancyBox - thumbnail helper (this is optional) -->
<link rel="stylesheet" type="text/css" href="fancybox/source/helpers/jquery.fancybox-thumbs.css" />
<script type="text/javascript" language="JavaScript" src="fancybox/source/helpers/jquery.fancybox-thumbs.js"></script>

<script type="text/javascript">
$(document).ready(function() {
$(".various").fancybox({
    maxWidth    : 800,
    maxHeight   : 600,
    fitToView   : false,
    width       : '70%',
    height      : '70%',
    autoSize    : false,
    closeClick  : false,
    openEffect  : 'none',
    closeEffect : 'none',
    type : 'iframe',
});
});
</script>
</head>

<body>


<a class="various fancybox.iframe" href="http://www.youtube.com/embed/L9szn1QQfas?autoplay=1">Youtube (iframe)</a>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心舞飞扬 2025-01-12 04:17:28

尝试访问 http://localhost/fancybox/lib/jquery-1.7.1。 min.js 并查看是否可以获取该文件。
如果没有尝试更改要加载的文件源。
确保您对脚本所在的文件夹具有读写权限。

或者将脚本上传到网络服务器并将所有源路径更改为:

src="fancybox/lib/jquery-1.7.1.min.js"

src =“http://www.yourdomain.com/fancybox/lib/jquery-1.7.1.min.js”

Try to access http://localhost/fancybox/lib/jquery-1.7.1.min.js and see if you can get the file.
If not try to change the source of files you want to load.
Make sure you have read&write permissions for the folder your scripts are in.

or upload the scripts to a webserver and change all paths to the sources like:

src="fancybox/lib/jquery-1.7.1.min.js"

to

src="http://www.yourdomain.com/fancybox/lib/jquery-1.7.1.min.js"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文