0
我试图移动导航栏取决于鼠标位置的工作,但我不能使平滑当我将鼠标移动到一个点然后停止,裕度顶部花费很长时间来更新新值。这使得它看起来平滑的动画像jittring代替根据鼠标位置滚动导航栏不光滑需要改进
function nav_animate(e) {
var mouse_y = e.pageY;
if (mouse_y < 200) {
var old_y = $("#nav-style").css('margin-top').replace('px', '');
var new_y = parseInt(old_y);
var tmp = -(mouse_y + new_y);
if (tmp > 0) {
tmp = 0;
}
$("#nav-style").css({ 'margin-top': tmp + 'px' });
}else {
$("#nav-style").css({ 'margin-top': '-101px' });
}
}
$(document).ready(function() {
$(document).on('mousemove', nav_animate);
});
,因为我没有提出我的问题以及这里是该网站即时通讯的链接做here
使用'translateX' CSS变换修改的保证金来代替。 Cf [用CSS3实现60 FPS动画](https://medium.com/outsystems-experts/how-to-achieve-60-fps-animations-with-css3-db7b98610108) –
它是页面将滚动到在页面中特别是'div'? –
没有它的只是导航栏下降鼠标走近 –