Detecting 'transform: translate3d' support

前端 未结 12 1653
遥遥无期
遥遥无期 2020-11-29 19:03

Does anyone know how I would detect transform: translate3d(x,y,z) support is available?

My issue is that I want to use translate3d across b

12条回答
  •  独厮守ぢ
    2020-11-29 19:54

    The original blog post announcing 3D transforms has an image flip demo, which does it with a media query, like this:

    @media all and (-webkit-transform-3d) {
      /* Use the media query to determine if 3D transforms are supported */
      #flip-container {
        -webkit-perspective: 1000;
      }
      #flip-card {
        width: 100%;
        height: 100%;
        -webkit-transform-style: preserve-3d;
        -webkit-transition: -webkit-transform 1s;
      }
      #flip-container:hover #flip-card {
        -webkit-transform: rotateY(180deg);
      }
    }
    

    This blog post has a good intro to media queries. This has some more details.

提交回复
热议问题