2
我正在开发一个图片库,照片分别滑动left
和right
,鼠标分别为scroll up
和scroll down
。jQuery UI switchClass()不能正常工作
有5张照片画廊看起来是这样的:
http://www.games07.tk/Untitled.png
功能:
function scrollPhotosLeft()
{
$(".photo0").switchClass("photo0","photo1",500);
$(".photo1").switchClass("photo1","photo2",500);
$(".photo2").switchClass("photo2","photo4",500);
$(".photo3").switchClass("photo3","photo0",500);
$(".photo4").switchClass("photo4","photo3",500);
}
function scrollPhotosRight()
{
$(".photo0").switchClass("photo0","photo3",500);
$(".photo1").switchClass("photo1","photo0",500);
$(".photo2").switchClass("photo2","photo1",500);
$(".photo3").switchClass("photo3","photo4",500);
$(".photo4").switchClass("photo4","photo2",500);
}
CSS:
.photo0{
top: 50%;
left: 50%;
}
.photo1{
top: 40%;
left: 30%;
}
.photo2{
top: 30%;
left: 10%;
}
.photo3{
top: 40%;
left: 70%;
}
.photo4{
top: 30%;
left:90%;
}
个向下滚动原因没有问题,但在某些情况下,向下滚动,突然向上滚动使照片看起来像这样:
http://www.games07.tk/Untitled2.png
有什么办法来克服这个问题,或者实现这个任何其他方式?
我已经注意到,后向上滚动向下switchClass()是给同一类的图像和一些组合(得到这个来自谷歌浏览器检查元素)
您是否尝试过其他浏览器以查看它是否运行不同? – 2013-03-09 04:33:57
可能的重复:http://stackoverflow.com/questions/7925994/jquery-ui-switchclass-method-is-not-working-properly? – greener 2013-03-09 04:35:39
@AdamPlocher在firefox switchClass()不工作 – 2013-03-09 04:42:55