【问题标题】:Trying to use the fancybox image system尝试使用fancybox图像系统
【发布时间】:2012-02-14 07:18:57
【问题描述】:

我正在尝试使用这里描述的fancybox系统:http://fearlessflyer.com/2011/01/create-an-awesome-photo-gallery-with-fancybox-and-timthumb/

我可以显示缩略图,但是当我包含 rel=lightbox 功能和脚本时,我看不到精美的盒子系统工作(缩略图看起来相同)。当我单击路径中包含 rel=lightbox 的图像时,我收到一条错误消息,指出在此服务器上找不到路径。

我正在使用最新版本的 jquery (jquery-1.7.1.min.js) 和花式框 (v 1.3.4)。

代码如下:

<?php 
    $path =  'http://' . $_SERVER['SERVER_NAME'] . '/WhereTheImagesAre/'; 
    $files = scandir('WhereTheImagesAre/'); 

?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
<head>
    <meta charset="utf-8">
    <link rel="shortcut icon" href="/favicon.ico?">
    <title>Title</title>
    <link type="text/css" href="/CSS/style.css" rel="stylesheet" media="screen" />
    <script type="text/javascript" src="Scripts/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="Scripts/jquery.fancybox-1.3.4.js"></script>
    <link rel="stylesheet" type="text/css" href="Scripts/fancybox/jquery.fancybox-1.3.4.css" />
    <script>

        $(document).ready(function(){
                $("a[rel=lightbox]").fancybox({
                        'transitionIn'      : 'elastic', 
                                                'transitionOut'     : 'elastic'     
                                                });
                                        });

    </script>


</head>
<body>

    <div class="logo"><img src="/images/Logo.png"/></div>

    <div class="wrap">
        <div class="content_wrap">
            <div class="content">

                <ul>
                    <?php foreach ($files as $file){ 
                            if ($file == '.' || $file == '..'){ 
                            echo ''; 
                            } else {
                            ?>
                    <li ><a href="<?php echo $path . $file; ?> rel=”lightbox” "><img src="Scripts/timthumb.php?src=<?php echo $path . $file; ?>&h=194&w=224&zc=1&q=100" /></a></li>
                    <?php } }?>
                </ul>

            </div>
        </div>
    </div>

</body>
</html>

如果您能帮我确定出了什么问题,我将不胜感激。谢谢。

【问题讨论】:

    标签: php jquery image


    【解决方案1】:

    rel 在 href 中

    <a href="<?php echo $path . $file; ?> rel=”lightbox” ">
    

    应该是

    <a href="<?php echo $path . $file; ?>" rel=”lightbox”>
    

    【讨论】:

    • 即使有这个变化,我仍然没有看到花哨的盒子效果很遗憾......可能是别的什么吗?
    猜你喜欢
    • 1970-01-01
    • 2011-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多