javascript - Fancybox 1.3.4 无法正常工作

标签 javascript jquery css fancybox

嘿,我正在尝试实现 fancybox 1.3.4,但我无法让它工作 这是我的代码:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery    /1.4/jquery.min.js"></script>
<script type="text/javascript" src="/fancybox/jquery.easing-1.3.pack.js"></script>
<script src="/fancybox/jquery.fancybox-1.3.4.pack.js" type="text/javascript"></script>
<script src="/fancybox/jquery.fancybox-1.3.4.js" type="text/javascript"></script>
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="/fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" type="text/css"   media="screen" />
<script type="text/javascript">

$(document).ready(function() {

/* This is basic - uses default settings */

$(".image").fancybox();

/* Using custom settings */

$(".iframe").fancybox({
    'hideOnContentClick': false
});


$("a[href$=.jpg],a[href$=.png],a[href$=.gif]").fancybox();

$(".youtube").click(function() {
    $.fancybox({
        'padding': 0,
        'autoScale': false,
        'transitionIn': 'none',
        'transitionOut': 'none',
        'title': this.title,
        'width': 680,
        'height': 495,
        'href': this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
        'type': 'swf',
        'swf': {
            'wmode': 'transparent',
            'allowfullscreen': 'true'
        }
    });

    return false;
});

这是我希望 fancybox 打开的图像。目前它只是显示在一个新标签中。 我使用 firebug,我可以看到每个脚本和样式表都已加载。

 <a class="image" href="http://localhost:2053/files/15-20/theme3/test%20Photo.jpg">test Photo</a>

最佳答案

我猜这只是一个剪切和粘贴错误,但为了以防万一,我将说明明显的情况。您的 jquery 路径中有空格:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery    /1.4/jquery.min.js"></script>

应该是:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>

要 100% 确保 jquery 已加载,请打开 Firebug 控制台并运行此代码段:

$().jquery;

它应该通过打印版本号来响应。

关于javascript - Fancybox 1.3.4 无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5489932/

相关文章:

asp.net - 在网页中嵌入字体

javascript - iOS 停止随机发送 httprequests[Titanium]

javascript - 当我使用 input type=button 时,它的值不会发送到服务器

javascript - jquery sleep 未在 ajax 请求上执行

javascript - 如何在不从图例中删除饼图的情况下在 HighCharts 中隐藏饼图的切片?

html - 访问的输入宽度

javascript - 多选,当选择某一选项时,取消选择其他选项

javascript - 关闭 Bootstrap 模式后无法单击任何内容

javascript - 在 bootstrap 或其他 jquery 对话框中显示各种信息的最佳方式

javascript - 在HTML中加载页面3秒后加载引导警报