我有这个CSS代码
#storage_screen {
top: -100%;
width: 100%;
height: 100%;
background: url(../images/new24/_landing/storage_window/container_background.png);
position: absolute;
z-index: 99999999999999;
}
和这个jquery代码
$('#storage_icon').click(function() {
$("#storage_screen").animate({top: "0"}, 600,);
});
但是当我尝试它时,由于某种原因,动画似乎从中途开始,我认为这与百分比有关。
如果有人知道对此有任何修复,我将非常感激! :)
最佳答案
问题很可能是您尝试从百分比值到像素值(0 像素)设置动画。如果您将动画目标更改为 0%
而不仅仅是 0
,它应该可以工作。
$('#storage_icon').click(function() {
$("#storage_screen").animate({top: "0%"}, 600);
});
关于jQuery 动画从中途开始,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8885013/