[英]Easing animation in JavaScript without jQuery or other libraries
I want to have a <div>
come into a webpage from the right when you hover over it. 当您将鼠标悬停在网页上时,我想从右侧进入<div>
网页。 So something like this: 所以像这样:
$('div.from_right').hover(function() {
$(this).animate({right: '-300px'});
});
But I don't want to use jQuery or any other libraries. 但是我不想使用jQuery或其他任何库。 Is there a built-in mechanism within JavaScript to animate the position? JavaScript中是否有内置机制可以对位置进行动画处理? Or do I call requestAnimationFrame()
repeatedly until the <div>
is where I want it to be? 还是我重复调用requestAnimationFrame()
直到<div>
是我想要的位置?
I only care about modern browsers. 我只关心现代浏览器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.