jquery灯箱不加载图像 [英] jquery lightbox does not load images

查看:83
本文介绍了jquery灯箱不加载图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图此Lightbox 起作用,而我并不确定

我的相关代码如下:

 < HEAD> 
< link href =style.css =stylesheettype =text / css>
< script type =text / javascriptsrc =jquery.js>< / script>
<! - 灯箱 - >
< script type =text / javascriptsrc =jquery.lightbox-0.5.js>< / script>
< link rel =stylesheettype =text / csshref =jquery.lightbox-0.5.cssmedia =screen/>

< script type =text / javascript>
$(document).ready(function(){
$(img.comidas)。lightBox();
});

< / script>
< / head>

图像以这种方式显示:

 < TR> 
< td>< a href =images / big-boss-adulto.jpg>< img src =images / big-boss-adulto.jpgwidth =118height = 170class =comidas/>< / a>< / td>
< td>< a href =#>< img src =images / big-boss-cachorro.jpgwidth =118height =170class =comidas/ >< / A>< / TD>
< td>< a href =#>< img src =images / eukanuba-adulto.jpgwidth =118height =170class =comidas/> < / A>< / TD>
< / tr>

(我只是在尝试如果Lightbox在第一张图片上工作)



问题ID如下,灯箱卡在这里(在加载部分):



我检查过的东西,我可以推断: p>


  • 所有js和css都正确链接并存在

  • 灯箱的javascript和styleshit很可能因为:


    • 样式似乎是正确的

    • 当您在图像外单击时(或按esc )lighbox消失




我检查的另一件事是使用load: / p>

  $(window).load(function(){
$(img.comidas)。lightBox() ;
});

但同样的问题似乎仍然存在。

解决方案

尝试选择包含< a> ()函数。


I am trying to get this lightbox to work and I'm not quite sure what I'm missing.

My relevant code is as follows:

<head>
    <link href="style.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="jquery.js"></script>            
    <!-- Lightbox -->
    <script type="text/javascript" src="jquery.lightbox-0.5.js"></script>
    <link rel="stylesheet" type="text/css" href="jquery.lightbox-0.5.css" media="screen" />

    <script type="text/javascript">
        $(document).ready(function() {        
            $("img.comidas").lightBox();
        });

    </script>       
</head>

The images are displyed in this manner:

<tr>
    <td><a href="images/big-boss-adulto.jpg"><img src="images/big-boss-adulto.jpg" width="118" height="170" class="comidas"/></a></td>
    <td><a href="#"><img src="images/big-boss-cachorro.jpg" width="118" height="170" class="comidas"/></a></td>
    <td><a href="#"><img src="images/eukanuba-adulto.jpg" width="118" height="170" class="comidas"/></a></td>
</tr>

(I'm only trying if the lightbox works on the first image)

The problem id the following, the lightbox gets stuck here (in the loading part):

Things I've checked and that I can infer:

  • All the js and css are correctly linked and exist
  • The javascript and styleshit of the lightbox are probable working correctly since:
    • The style seems to be the correct
    • When you click outside the image (or press esc) the lighbox disappears

Another thing I've checked was using load:

$(window).load(function() {       
    $("img.comidas").lightBox();
});

But the same problem seems to persist.

解决方案

Try selecting the containing <a> element, instead of the image itself, for the lightbox() function.

这篇关于jquery灯箱不加载图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆