Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 使用FancyBox显示图像_Html_Image_Fancybox - Fatal编程技术网

Html 使用FancyBox显示图像

Html 使用FancyBox显示图像,html,image,fancybox,Html,Image,Fancybox,如何使用FancyBox显示图像?我已经试了好几个小时了 HTML: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>` <script type="text/javascript" src="js/fancyBox/source/jquery.fancybox.pack.js">&

如何使用FancyBox显示图像?我已经试了好几个小时了

HTML:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>`  
    <script type="text/javascript" src="js/fancyBox/source/jquery.fancybox.pack.js"></script>  
    <link rel="stylesheet" href="js/fancyBox/source/jquery.fancybox.css" type="text/css" media="screen"/>


<a class="fancybox" href="house.jpg"><img src="house.jpg" alt="" height="400px" width="400px"/></a>  

<script>
    $(document).ready(function() {
        $('.fancybox').fancybox();
    });
</script>
`
$(文档).ready(函数(){
$('.fancybox').fancybox();
});

正如@JFK所指出的,您可能需要更高版本的jQuery。使用Fancybox提供的演示文件的示例:

<!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Fancybox Example</title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>`  
    <script type="text/javascript" src="js/fancyBox/source/jquery.fancybox.pack.js"></script>  
    <link rel="stylesheet" href="js/fancyBox/source/jquery.fancybox.css" type="text/css" media="screen"/>
</head>
<body>
<a class="fancybox" href="js/fancybox/demo/1_b.jpg">
    <img src="lib/fancybox/demo/1_b.jpg" alt="" height="400px" width="400px"/>
</a> 
</body>
</html>

<script>
    $(document).ready(function() {
        $('.fancybox').fancybox();
    });
</script>

Fancybox示例
`  
$(文档).ready(函数(){
$('.fancybox').fancybox();
});

fancybox v2.x?尝试将jQuery至少升级到v1.7或更高版本