0

我从这里下载了 fancyBox:

http://fancyapps.com/fancybox/#license

这是我在“测试”网页中的代码:

<!DOCTYPE html>
<html lang="en">
    <head>  
        <title>fancyBox</title>
        <meta charset="utf-8">

        <!-- Add jQuery library -->
        <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js">

        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
        <script type="text/javascript" src="source/jquery.fancybox.pack.js"></script>
        <script type="text/javascript" src="lib/jquery-1.10.1.min.js"></script>

        <!-- Add fancyBox main JS and CSS files -->
        <script type="text/javascript" src="source/jquery.fancybox.js"></script>
        <link rel="stylesheet" type="text/css" href="source/jquery.fancybox.css" media="screen" />

        <!-- Add Button helper (this is optional) -->
        <link rel="stylesheet" href="source/helpers/jquery.fancybox-buttons.css" type="text/css" media="screen" />
        <script type="text/javascript" src="source/helpers/jquery.fancybox-buttons.js"></script>
        <link rel="stylesheet" type="text/css" href="source/helpers/jquery.fancybox-buttons.css" />
        <script type="text/javascript" src="source/helpers/jquery.fancybox-buttons.js"></script>

        <!-- Add Media helper (this is optional) -->
        <script type="text/javascript">
        $(document).ready(function() {
            /*
                *  Simple image gallery. Uses default settings
            */

            $('.fancybox').fancybox();

                /*  Different effects */

                // Change title type, overlay closing speed

            /*  Button helper. Disable animations, hide close button, change title type and content */

            $('.fancybox-buttons').fancybox({
                openEffect  : 'none',
                closeEffect : 'none',
                prevEffect : 'none',
                nextEffect : 'none',
                closeBtn  : false,
                helpers : {
                    title : {
                        type : 'inside'
                    },
                    buttons : {}
                },
                afterLoad : function() {
                    this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
                }
            });

        </script>
        <style type="text/css">
            .fancybox-custom .fancybox-skin {
                box-shadow: 0 0 50px #222;
            }
            body {
                max-width: 700px;
                margin: 0 auto;
            }
        </style>
    </head>
    <body>
        <h3>Button helper</h3>
        <p>
            <a class="fancybox-buttons" data-fancybox-group="button" href="1_b.jpg"><img src="1_s.jpg" alt="" /></a>
            <a class="fancybox-buttons" data-fancybox-group="button" href="2_b.jpg"><img src="2_s.jpg" alt="" /></a>
            <a class="fancybox-buttons" data-fancybox-group="button" href="3_b.jpg"><img src="3_s.jpg" alt="" /></a>
            <a class="fancybox-buttons" data-fancybox-group="button" href="4_b.jpg"><img src="4_s.jpg" alt="" /></a>
        </p>
    </body>

</html>

我想我的服务器上有正确的路径,但这就是我所看到的:

http://www.bayingwolf.com/site_pop_up/image_pop.html

而不是他们网站上的 fancyBox(在 Button Helper 下)。

请问我做错了什么?

谢谢。

蓝色的

4

2 回答 2

0

几个问题

1)jquery.fancybox-1.3.4.pack.js未加载..(404 错误。)您可能需要正确检查路径 2)$(document).ready(function(){ 缺少结束标签

<script>
$(document).ready(function() {
        $('.fancybox').fancybox();
        $('.fancybox-buttons').fancybox({
            openEffect  : 'none',
            closeEffect : 'none',
            prevEffect : 'none',
            nextEffect : 'none',
            closeBtn  : false,
            helpers : {
                title : {
                    type : 'inside'
                },
                buttons : {}
            },
            afterLoad : function() {
                this.title = 'Image ' + (this.index + 1) + ' of ' + 
                              this.group.length + 
                              (this.title ? ' - ' + this.title : '');
            }
        });
})
</script>

建议

正确缩进代码以避免细微的错误。

于 2013-09-27T23:36:01.260 回答
0

我得到一个 404

“网络错误:404 未找到 - http://www.bayingwolf.com/site_pop_up/source/jquery.fancybox-1.3.4.pack.js

于 2013-09-27T23:14:35.753 回答