我正在尝试让灯箱在我的画廊上运行。自从我在alert()
函数中使用documet.ready()
进行测试后,Jquery就可以工作了。但除此之外,灯箱似乎不起作用。或者至少我只有链接正常工作。这是我的代码:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<title></title>
<meta charset="UTF-8" />
<meta name="ROBOTS" content="ALL" />
<meta name="MSSmartTagsPreventParsing" content="true" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href='http://fonts.googleapis.com/css?family=Raleway:100' rel='stylesheet' type='text/css'>
<link href="/fuelcms/assets/css/klang.css?c=943916400" media="all" rel="stylesheet"/>
<base href="http://localhost/fuelcms/index.php" />
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<meta name="robots" content="index, follow" />
<script type="text/javascript" src="assets/js/jquery.js"></script>
<script type="text/javascript" src="assets/js/lightbox/prototype.js"></script>
<script type="text/javascript" src="assets/js/lightbox/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="assets/js/lightbox/lightbox.js"></script>
<link rel="stylesheet" href="assets/css/lightbox.css" type="text/css" media="screen" />
</head>
<body class="gallery index">
<!--<div class="header"><ul>
<li class="first"><a href="http://localhost/fuelcms/index.php/repertoire" title="Repertoire">Repertoire</a></li>
<li><a href="http://localhost/fuelcms/index.php/about" title="Über uns">Über uns</a></li>
<li><a href="http://localhost/fuelcms/index.php/kontakt" title="Kontakt">Kontakt</a></li>
<li><a href="http://localhost/fuelcms/index.php/agenda" title="Agenda">Agenda</a></li>
<li><a href="http://localhost/fuelcms/index.php/gallery" title="Gallerie">Gallerie</a></li>
<li class="last"><a href="http://localhost/fuelcms/index.php/links" title="Links">Links</a></li>
</ul>
</div>-->
<ul>
<li class="first"><a href="http://localhost/fuelcms/index.php/repertoire" title="Repertoire">Repertoire</a></li>
<li><a href="http://localhost/fuelcms/index.php/about" title="Über uns">Über uns</a></li>
<li><a href="http://localhost/fuelcms/index.php/kontakt" title="Kontakt">Kontakt</a></li>
<li><a href="http://localhost/fuelcms/index.php/agenda" title="Agenda">Agenda</a></li>
<li><a href="http://localhost/fuelcms/index.php/gallery" title="Gallerie">Gallerie</a></li>
<li class="last"><a href="http://localhost/fuelcms/index.php/links" title="Links">Links</a></li>
</ul>
<div class="fullpage">
<div class="colmask">
<div class="col3">
<div class="pagination"><a href="http://localhost/fuelcms/index.php/gallery/index/">‹ First</a> <a href="http://localhost/fuelcms/index.php/gallery/index/7"><</a> <a href="http://localhost/fuelcms/index.php/gallery/index/6">7</a> <a href="http://localhost/fuelcms/index.php/gallery/index/7">8</a><strong>9</strong></div><br><div class="imagebox"><a rel="lightbox[col]" href="assets/images/fotos_site/Gong.JPG"><img src="http://localhost/fuelcms/assets/images/fotos_site/thumbs/Gong_thumb.jpg" alt=""/></a></div><div class="imagebox"><a rel="lightbox[col]" href="assets/images/fotos_site/Fatamorganaschatten.JPG"><img src="http://localhost/fuelcms/assets/images/fotos_site/thumbs/Fatamorganaschatten_thumb.jpg" alt=""/></a></div><div class="imagebox"><a rel="lightbox[col]" href="assets/images/fotos_site/Bumentopf2.JPG"><img src="http://localhost/fuelcms/assets/images/fotos_site/thumbs/Bumentopf2_thumb.jpg" alt=""/></a></div><div class="imagebox"><a rel="lightbox[col]" href="assets/images/fotos_site/Blumentopfdynamik.JPG"><img src="http://localhost/fuelcms/assets/images/fotos_site/thumbs/Blumentopfdynamik_thumb.jpg" alt=""/></a></div><div class="imagebox"><a rel="lightbox[col]" href="assets/images/fotos_site/Blumentopf.JPG"><img src="http://localhost/fuelcms/assets/images/fotos_site/thumbs/Blumentopf_thumb.jpg" alt=""/></a></div><div class="imagebox"><a rel="lightbox[col]" href="assets/images/fotos_site/Blument1.JPG"><img src="http://localhost/fuelcms/assets/images/fotos_site/thumbs/Blument1_thumb.jpg" alt=""/></a></div></div></div><div class="footer" />
</body>
</html>
我也尝试过使用head标签中的script标签,但没有区别,请帮忙。
greez almightybob
答案 0 :(得分:3)
您使用XHTML进行编码(使用自动关闭标记),但未声明XHTML文档类型。在SO
<link>
,<meta>
和<base>
本身是自动关闭的,但<script>
应始终由</script>
关闭以确保安全无论是外部还是内部措施。我的IDE(Aptana Studio 3)就是这样做的(知道它有内置验证,在我看来一定是“最佳实践”)
虽然不确定,但我认为您可以在使用最新的jQuery选择灯箱时省略@
:$('a[rel*=lightbox]').lightBox()
多久以前是1.4?尝试更新的jQuery版本!
答案 1 :(得分:1)
之前我遇到过这个问题并通过在结束的body标记之前放置以下内容来解决它:
<script>
$.noConflict();
</script>
也许这会帮助你。
注意:这适用于我使用Google CDN上托管的最新jQuery(1.7.1)和Lightbox 2.05 located here。您使用的是不同的Lightbox实现吗?如果没有,你肯定会坚持使用jQuery和Lightbox的旧版本。