如何实现这个简单的jQuery图像库?
我正在尝试制作一个简单的jQuery库,其中只有3张图片,如下图所示 我这样翻译:如何实现这个简单的jQuery图像库?,jquery,image-gallery,Jquery,Image Gallery,我正在尝试制作一个简单的jQuery库,其中只有3张图片,如下图所示 我这样翻译: if thumb clicked -> this thumb -> become big current big -> become thumb 问题是,我不知道我翻译它的方式看起来如何正确 谢谢请尝试以下方法: <html> <head> <title>Simple Gallery</title> <script src="jq
if thumb clicked -> this thumb -> become big
current big -> become thumb
问题是,我不知道我翻译它的方式看起来如何正确
谢谢请尝试以下方法:
<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>
简单画廊
函数ChangeThis(getThumb)
{
对于(var i=1;i