jQuery图像悬停旋转
是否有机会在悬停时更改图像src,数到10,然后从第一个开始再返回 这就是我需要的,这是默认的拇指,flv-3.jpgjQuery图像悬停旋转,jquery,thumbnails,Jquery,Thumbnails,是否有机会在悬停时更改图像src,数到10,然后从第一个开始再返回 这就是我需要的,这是默认的拇指,flv-3.jpg <img src="/thumbs/e/b/d/6/d/ebd6d2d6d99e/ebd6d2d6d99e.flv-3.jpg" /> 鼠标悬停时只需更改数字 flv-1.jpg flv-2.jpg flv-3.jpg flv-4.jpg 等等 最多10个,然后再次返回并从数字1开始,但当我从拇指移动鼠标时,需要返回默认拇指flv-3.jpg 这是我现在使
<img src="/thumbs/e/b/d/6/d/ebd6d2d6d99e/ebd6d2d6d99e.flv-3.jpg" />
鼠标悬停时只需更改数字
- flv-1.jpg
- flv-2.jpg
- flv-3.jpg
- flv-4.jpg
- 等等
var _thumbs = new Array();
function changeThumb(index, i, num_thumbs, path)
{
if (_thumbs[index])
{
document.getElementById(index).src = path + i + ".jpg";
preload = new Image();
preload_image_id = (i + 1 > num_thumbs) ? 1 : i + 1;
preload.src = path + preload_image_id + ".jpg";
i = i % num_thumbs;
i++;
setTimeout("changeThumb('" + index + "'," + i + ", " + num_thumbs + ", '" + path + "')", 800)
}
}
function startThumbChange(index, num_thumbs, path)
{
if (num_thumbs < 2) return false;
_thumbs[index] = true;
changeThumb(index, 1, num_thumbs, path);
}
function endThumbChange(index, image)
{
_thumbs[index] = false;
document.getElementById(index).src = image;
}
var\u thumbs=new Array();
函数changeTumb(索引、i、num_拇指、路径)
{
如果(_thumbs[索引])
{
document.getElementById(index).src=path+i+“.jpg”;
预加载=新图像();
预加载图片id=(i+1>num\u thumbs)?1:i+1;
preload.src=path+preload\u image\u id+“.jpg”;
i=i%num\u拇指;
i++;
setTimeout(“changeThumb”(“+index+”、“+i+”、“+num_thumbs+”、“+path+”)、800)
}
}
函数startThumbChange(索引、数量、路径)
{
如果(num_thumbs<2)返回false;
_拇指[索引]=真;
changeThumb(索引,1,num_thumbs,路径);
}
函数endThumbChange(索引、图像)
{
_拇指[索引]=假;
document.getElementById(index).src=image;
}
和html
<img onmouseout="endThumbChange('515e9279d96c6', '/thumbs/e/b/d/6/d/ebd6d2d6d99e/ebd6d2d6d99e.flv-3.jpg');" onmouseover="startThumbChange('515e9279d96c6', '10', '/thumbs/e/b/d/6/d/ebd6d2d6d99e/ebd6d2d6d99e.flv-','.jpg');" id="515e9279d96c6" src="/thumbs/e/b/d/6/d/ebd6d2d6d99e/ebd6d2d6d99e.flv-3.jpg" class="img">
还有可能在拇指改变时添加淡入淡出的效果?var定时器
$('div.settingsButton').hover(function() {
var angle = 0,
$this = $(this);
timer = setInterval(function() {
angle += 4;
$this.rotate(angle);
}, 50);
},
function() {
timer && clearInterval(timer);
$(this).rotate(0);
这里的哦,不,我的意思是关于更改图像SROK,我会尝试这样做。