0
我正在使用Angular2为我的Web应用程序(在移动版本中)开发一个侧面菜单。抽屉菜单表演
这当菜单关闭
.main-drawer
{
left: -300px;
width: 300px;
max-width: 100%;
z-index: 2;
transition-property: left;
transition-duration: 300ms;
transition-timing-function: ease-out;
}
当用户按下开菜单按钮,我添加使用jQuery
.main-drawer.opened
{
left:0;
transition-property: left;
transition-duration: 300ms;
transition-timing-function: ease-out;
}
这是js代码下面的类类:
let drawer = jQuery ('.main-drawer');
drawer.toggleClass ('opened', !drawer.hasClass ('opened'));
在桌面电脑上使用此代码的性能很好,但在移动版本上它是lagg年。 有没有办法提高每个性能?
菜单非常轻巧,不包含很多节点。 我注意到,即使菜单充满了其他网站,其他网站也有不错的表现。
非常感谢
谢谢安迪,它的工作原理就像一个沙滩! 你有其他的建议吗? 再次感谢您 – user3471528
以下是您阅读的好消息:https://developers.google.com/web/fundamentals/performance/rendering/。另外谷歌关于保罗爱尔兰和网络性能。 –