1

Last safari 10 给我带来了 3D 渲染的新痛苦。在以前的版本中,它使用 -webkit-transform: translate3d(0,0,0); 修复。但是不是现在。 示例(仅 safari 10): https ://jsfiddle.net/rhbs755c/4/ 代码:

var browserPrefix = "",
    usrAg = navigator.userAgent,
    thisElement = $('.main-slider__text-bg');

$(window).mousemove(function (event) {
    var cx = Math.ceil(window.innerWidth / 2.0),
        cy = Math.ceil(window.innerHeight / 2.0),
        dx = event.pageX - cx,
        dy = event.pageY - cy,
        tiltx = (dy / cy),
        tilty = - (dx / cx),
        radius = Math.sqrt(Math.pow(tiltx, 2) + Math.pow(tilty, 2)),
        degree = (radius * 20);

        thisElement.css('transform', 'rotate3d(' + tiltx + ', ' + tilty + ', 0, ' + degree + 'deg)');
});
.main-slider__text-wrap { 
  position: relative;
  padding: 20px;
  max-width: 300px;
  margin: 50px auto;
  -webkit-transform: translate3d(0,0,0);
}
.main-slider__text-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: pink;
  z-index: 0;
 }
 .main-slider__text {
   font-size: 14px;
   color: #000;
   position: relative;
   z-index: 1;
   -webkit-transform: translate3d(0,0,0);
 }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="main-slider__text-wrap">
    <span class="main-slider__text-bg"></span>
    <p class="main-slider__text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iure, laborum non soluta natus quidem deleniti vel aliquam at assumenda, labore eum sed. Mollitia voluptatem porro quia. Quasi numquam, eaque distinctio.</p>
</div>

有人知道,如何解决?

4

0 回答 0