试图让jquery图像缩放插件工作

时间:2012-08-21 12:41:28

标签: jquery image zoom

这是我正在努力工作的插件 http://andreaslagerkvist.com/jquery/image-zoom/

无论我点击标签时我做什么都没有 我也没有错误...... 这是我为测试目的而创建的html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="jquery.imageZoom.css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script src="jquery.imageZoom.js"></script>
<script type="text/javascript">
$("div.jquery-image-zoom").imageZoom();
</script>
</head>
<body>
<div id="jquery-image-zoom">
<ul>
<li><a href="http://exscale.se/__files/3d/bloodcells.jpg">Bloodcells</a></li>
<li><a href="http://exscale.se/__files/3d/x-wing.jpg">X-Wing</a></li>
<li><a href="http://exscale.se/__files/3d/weve-moved.jpg">We've moved</a></li>
</ul>
<ul>
<li><a href="http://exscale.se/__files/3d/lamp-and-mates/lamp-and-mates-01.jpg">
<img src="http://exscale.se/__files/3d/lamp-and-mates/lamp-and-mates-01_small.jpg" alt="Lamp and Mates" /></a></li>
<li><a href="http://exscale.se/__files/3d/stugan-winter.jpg">
<img src="http://exscale.se/__files/3d/stugan-winter_small.jpg" alt="The Cottage - Winter      time" /></a></li>
<li><a href="http://exscale.se/__files/3d/ps2.jpg">
<img src="http://exscale.se/__files/3d/ps2_small.jpg" alt="PS2" /></a></li>
</ul>
</div>
</body>
</html>

任何人都可以尝试获得在线的工作副本,这样我就能与自己进行比较,最终意识到我做错了什么?

1 个答案:

答案 0 :(得分:2)

我注意到的第一件事是您使用ID标签,但您没有选择ID。你选择了一个班级。另外,我可能希望在documentready时执行此操作。

纠正选择器:

$('document').ready( function() {
    $("div#jquery-image-zoom").imageZoom();
});