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



这是我正在尝试使用的插件http://andreaslagerkvist.com/jquery/image-zoom/

无论我点击a标签时做什么,都不会发生任何事情我也没有犯错误。。。这是我为测试而创建的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>

有没有可能有人尝试在网上获得一份工作副本,这样我就可以与自己的副本进行比较,最终意识到我做错了什么?

我首先注意到的是,您使用了ID标记,但没有选择ID。您选择了一个类。此外,当documentready时,我可能希望这样做。

正确的选择器:

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

最新更新