【问题标题】:Fancybox 2.1.5 hides my images when clicked onFancybox 2.1.5 在点击时隐藏我的图像
【发布时间】:2015-06-16 17:50:15
【问题描述】:

我最近用fancybox 构建了一个小页面,但我遇到了一个烦人的问题,即fancybox 隐藏了我页面中的图像。

所以当我关闭我的画廊(fancybox)时,我所有的缩略图都消失了。

这是我的html

<a class="fancybox" src="/style/images/project1/fullsize/image1.jpg" data-fancybox-group="gallery" title="Lorem ipsum dolor."><img src="/style/images/project1/thumb/image1.jpg"></a>

以及我正在加载的脚本。

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery.fancybox.js?v=2.1.5"></script>
<link rel="stylesheet" type="text/css" href="/style/jquery.fancybox.css?v=2.1.5" media="screen" />
<script type="text/javascript" src="/js/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>
<link rel="stylesheet" href="/style/style.css">
<link rel="stylesheet" type="text/css" href="/style/helpers/jquery.fancybox-thumbs.css?v=1.0.7" />

【问题讨论】:

    标签: javascript jquery html fancybox


    【解决方案1】:

    问题是由您的 HTML 代码中的语法错误造成的:您在锚点中使用了 src 属性,例如:

    <a class="fancybox" src="/style/images/project1/fullsize/image1.jpg" ....
    

    &lt;a&gt; 元素的正确属性是href,例如:

    <a class="fancybox" href="/style/images/project1/fullsize/image1.jpg" ....
    

    JSFIDDLE 使用src 属性重现了该问题。

    Here 使用正确的href 属性修复

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-13
      • 2019-07-06
      相关资源
      最近更新 更多