jquery 灯箱问题

发布于 2024-12-18 02:22:02 字数 1674 浏览 1 评论 0原文

我第一次接触jquery,我们需要做一个简单的照片效果。

问题是,我做了教程所说的所有事情,但没有灯箱效果。

这是我的 html 文档的头部(没有头部标签):

  <link rel="stylesheet" href="css/styles.css" type="text/css" media="screen" charset="utf-8" />
  <script src="jquery.js" type="text/javascript"></script>
  <script src="js/assignment.js" type="text/javascript"></script>
  <script type="text/javascript" src="js/jquery.lightbox-0.4.js"></script>
  <link rel="stylesheet" type="text/css" href="css/jquery.lightbox-0.4.css" media="screen" />
   <script type="text/javascript">  
      $(function() {
        $("a.lightbox").lightBox();
    }) ;
      </script>

这是我的链接:

  <aside id="comment">
    <h2>The Apes!</h2>
    <span>Lead Singer</span><span>Drums</span>
    <span>Guitar</span><span>Bass</span>
        <a href="images/Bill.jpg" class="lightbox"><img src = "images/Bill.jpg" rel="lightbox" alt="Lead Singer" title="Band member 1" /></a>
        <a href="images/Ryan.jpg" class="lightbox"><img src = "images/Ryan.jpg" rel="lightbox" alt="Guitar" title="Band member 2" /></a>
        <a href="images/Kerry.jpg" class="lightbox"><img src = "images/Kerry.jpg" rel="lightbox" alt="Drums" title="Band member 3" /></a>
        <a href="images/Bob.jpg" class="lightbox"><img src = "images/Bob.jpg" rel="lightbox" alt="Bass" title="Band member 4" /></a>
        </aside>

我缺少什么?据我了解,我给出了要链接到的图片的 href(比尔图像 - 全尺寸)和一个链接,这是在我的 css 中缩小尺寸的同一张照片。

啊啊。

I am dabbling for the first time in jquery, and we need to do a simple photo effect.

Problem is, I do everything the tutorials say to do, but no lightbox effect.

Here is the head of my html doc (without the head tags):

  <link rel="stylesheet" href="css/styles.css" type="text/css" media="screen" charset="utf-8" />
  <script src="jquery.js" type="text/javascript"></script>
  <script src="js/assignment.js" type="text/javascript"></script>
  <script type="text/javascript" src="js/jquery.lightbox-0.4.js"></script>
  <link rel="stylesheet" type="text/css" href="css/jquery.lightbox-0.4.css" media="screen" />
   <script type="text/javascript">  
      $(function() {
        $("a.lightbox").lightBox();
    }) ;
      </script>

Here are my links:

  <aside id="comment">
    <h2>The Apes!</h2>
    <span>Lead Singer</span><span>Drums</span>
    <span>Guitar</span><span>Bass</span>
        <a href="images/Bill.jpg" class="lightbox"><img src = "images/Bill.jpg" rel="lightbox" alt="Lead Singer" title="Band member 1" /></a>
        <a href="images/Ryan.jpg" class="lightbox"><img src = "images/Ryan.jpg" rel="lightbox" alt="Guitar" title="Band member 2" /></a>
        <a href="images/Kerry.jpg" class="lightbox"><img src = "images/Kerry.jpg" rel="lightbox" alt="Drums" title="Band member 3" /></a>
        <a href="images/Bob.jpg" class="lightbox"><img src = "images/Bob.jpg" rel="lightbox" alt="Bass" title="Band member 4" /></a>
        </aside>

What am I missing? As I understand, I give an href of a picture to link to (the Bill image - fullsize), and a link, which is the same photo which is downsized in my css.

Aaarrgh.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

余生共白头 2024-12-25 02:22:02

假设您没有缩小 CSS 中缩略图版本的大小,则您的 img src 和 href 指向相同的图像。灯箱不会增加图像的大小,它只是显示图像。如果您喜欢使用相同的图像名称(我喜欢),请将较小的图像与较大的图像放在不同的文件夹中。

例子:

`<a href="images/large/Bill.jpg" class="lightbox"><img src = "images/thumbs/Bill.jpg" rel="lightbox" alt="Lead Singer" title="Band member 1" /></a>`

Assuming you are not downsizing the thumbnail version in CSS somewhere, your img src and hrefs point to the same images. The lightbox doesn't increase the size of an image, it just displays it. If you like using the same image names (I do), put the smaller images in a different folder than the larger ones.

Example:

`<a href="images/large/Bill.jpg" class="lightbox"><img src = "images/thumbs/Bill.jpg" rel="lightbox" alt="Lead Singer" title="Band member 1" /></a>`
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文