banner鼠标交互动画

//banner鼠标交互动画
    $(".layerTransform").on("mousemove", function(e){
        var _this = $(this);
        var x = e.pageX;
        var y = e.pageY;
        //console.log(x);
        var w = _this.width();
        var h = _this.height();
        //console.log(w + "|" + h);
        var moveX = (x / w - .5) * -25 || 10,
            moveY = -(y / h - .5) * -20 || 10;
        _this.find(".layerTransformInner").css({"transform":"rotateX("+ moveY +"deg) rotateY("+ moveX +"deg)"});
    });
posted @ 2017-05-08 09:14  我是前端QQ942031558  阅读(181)  评论(0编辑  收藏  举报