jquery 灯箱问题
我第一次接触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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您没有缩小 CSS 中缩略图版本的大小,则您的 img src 和 href 指向相同的图像。灯箱不会增加图像的大小,它只是显示图像。如果您喜欢使用相同的图像名称(我喜欢),请将较小的图像与较大的图像放在不同的文件夹中。
例子:
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: