我试图让我页面上的缩略图在单击时“动画”到位。到目前为止它不起作用,但我不知道为什么或如何。有人可以提供对此的见解吗?我正在尝试使用“clicky”功能来做到这一点。基本上,我需要小缩略图在页面上的正确位置(基本上是页面的中间顶部)“增长”成正确的大小。谢谢!
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Farm Animals</title>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.10.2.js">
</script>
<script>
$('#cluster').hover(function(){
$(this).closest('cluster').css('display', 'block');
$(this).closest('cluster').css({ opacity: 1 });
},
function(){
$(this).closest('cluster').css('display', 'none');
$(this).closest('cluster').css({ opacity: 0.5 });
});
function hilite(a)
{
a.mouseOver(function(){$("#cluster").fadeTo("slow",.5);
}
</script>
<script type="text/javascript">
function imgFade()
{
$('#cluster, #launch, #gas').fadeTo(0, .3);
}
$(document).ready(function () {
$("#cluster, #launch, #gas")
.mouseover(function () {
$(this).fadeTo("slow", 1);
})
.mouseout(function () {
$(this).fadeTo("slow", .3);
});
});
function clicky(something)
{
var t = $(something);
t.animate({right:"150px",top:"150px"},2000);
}
function showImage(clickImg)
{
var dest = document.getElementById("dest");
dest.src=clickImg.src;
dest.alt=clickImg.alt;
var descr = document.getElementById("descr")
if (clickImg.alt == "cluster")
{
descr.innerHTML = holsteinDescr;
}
if (clickImg.alt == "gas")
{
descr.innerHTML = herefordDescr;
}
if (clickImg.alt == "launch")
descr.innerHTML = pigDescr;
}
function hilite()
{
$("#cluster").fadeIn("slow");
}
function lolite(x)
{
x.style.borderWidth = "0px";
}
</script>
<style type="text/css">
.clickable { cursor:pointer; height:50px; width:50px}
.thumbTD { width:60px; height:60px }
caption { font-size:18pt; }
table { border:0px }
#dest { width:400px; height:400px }
#descr { width:420px }
#leftColumn { vertical-align:top }
</style>
</head>
<body onload="imgFade()">
<table>
<caption>Select image on left for more information.</caption>
<tr>
<td id="leftColumn">
<table id ="ta">
<tr>
<td class="thumbTD">
<img id="cluster" class="clickable" onmouseover="hilite(this);" onmouseout="lolite
(this);" onclick="showImage(this);clicky=(this)" src="cluster.png" alt="holstein"/>
</td>
</tr>
<tr>
<td class="thumbTD">
<img id="gas" class="clickable" onmouseover="hilite(this);" onmouseout="lolite(this);"
onclick="showImage(this)" src="gas.png" alt="hereford" />
</td>
</tr>
<tr>
<td class="thumbTD">
<img id="launch" class="clickable" onmouseover="hilite(this);" onmouseout="lolite
(this);" onclick="showImage(this)" src="launch.jpg" alt="pig" />
</td>
</tr>
</table>
</td>
<td>
<table>
<tr>
<td><img id="dest" src="blank.jpg" alt="blank" /></td>
</tr>
<tr>
<td id="descr" > </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>