我正在尝试做一个简单的jQuery画廊,只有3张图片,如下图所示。

我是这样翻译的:
if thumb clicked -> this thumb -> become big
current big -> become thumb问题是我不知道我翻译的方式是如何看起来正确的?
谢谢
发布于 2012-10-14 23:20:15
请尝试以下操作:
<html>
<head>
<title>Simple Gallery</title>
<script src="jquery.js"></script>
<script>
function ChangeThis(getThumb)
{
for(var i=1;i<=3;i++)
{
if(getThumb == i)
{
$("#bigView").html("<img src='img"+i+"' />");
$("#thumb"+i).hide();
}
else
{
$("#thumb"+i).show();
}
}
}
</script>
<style>
#bigView{width:100px;height:100px;}
.thumb{width:30px;height:30px}
</style>
</head>
<body>
<table><tr><td colspan="3">
<div id="bigView"><img src='img1'></div>
</td></tr>
<tr>
<td><div id="thumb1" class="thumb" onclick="ChangeThis(1);" style="display:none;"><img src='img1' /></div></td>
<td><div id="thumb2" class="thumb" onclick="ChangeThis(2);"><img src='img2' /></div></td>
<td><div id="thumb3" class="thumb" onclick="ChangeThis(3);"><img src='img3' /></div></td>
</tr>
</table>https://stackoverflow.com/questions/12883320
复制相似问题