Chrome CSS 3 Transition Not Smooth

前端 未结 2 1394
孤独总比滥情好
孤独总比滥情好 2021-01-12 19:26

Hi working on a site design for a new site and the homepage has some flyup menus using CSS3 transitions.

If you go to --------- and take a look at the \"Some Menu t

2条回答
  •  情歌与酒
    2021-01-12 20:04

    You are causing browser reflows, which are expensive and change the layout on each animation step, causing the jerkyness and jitterness.

    To work around this, you need to apply absolute positioning to your animated elements, adding this to your CSS will get you started:

    .home .main-navigation ul {
      position: relative;
      height: 180px;
    }
    
    .home .main-navigation ul li {
      position: absolute;
      display: block;
    }
    
    .home .main-navigation ul li:nth-child(1) { left: 0;}
    .home .main-navigation ul li:nth-child(2) { left: 25%;}
    .home .main-navigation ul li:nth-child(3) { left: 50%;}
    .home .main-navigation ul li:nth-child(4) { left: 75%;}
    

    This is just a starting point, you will have to write more CSS in order to correctly display your elements with absolute positioning.

提交回复
热议问题