我正在试图隐藏一只蜜蜂,而它的运动还没有完成,如果它是专注的
这是蜜蜂,它最初隐藏在云层之外,看不到,在最初的4秒内,它从云端上升,然后在4秒内向右移动,然后在0.3秒内下降,就像它的隐藏一样,然后到达云端之外的原点,功能在20秒内重复。但我希望,在这些动作的同时,如果它被聚焦,我想让蜜蜂隐藏起来,我的意思是在0.3秒内下降,然后它会在20秒后再次出现。
var bee5 = function() {
$("#bee5").animate({"top": "-50px"}, 3000, function() {
$(this).animate({"left": "130px"}, 700,function() {
$(this).animate({"left": "110px"}, 800, function() {
$(this).animate({"left": "125px"}, 700, function() {
$(this).animate({"left": "115px"}, 800, function() {
$(this).animate({"left": "130px"}, 1000, function() {
$(this).animate({"left": "110px"}, 900, function() {
$(this).animate({"left": "120px"}, 800, function() {
$(this).animate({"top": "-10px"}, 250)
})
})
})
})
})
})
})
})
$('#bee5').mouseover(function() {
$(this).animate({"top": "-10px"}, 250)
});
setTimeout(bee5, 15000);
}这是css: bee5原始点
#bee5 { position:absolute; top:-10px; left:120px; z-index:0; }发布于 2011-09-10 18:13:57
如果要在指针悬停在项目上时制作动画,则应使用mouseover而不是focus,请参见this fiddle。
如果是表单输入,那么可以使用blur。
https://stackoverflow.com/questions/7370880
复制相似问题