我们计划将EasyPZ
用于拖放缩放(或滚轮)功能。以下代码的效果不稳定,我们想知道如何改善拖动功能。
var t = new EasyPZ(document.getElementsByClassName('yeah')[0], function(transform) {
$(".yeah").css({
"transform": "translateX(" + transform.translateX + "px) translateY(" + transform.translateY + "px) scale(" + transform.scale + ")",
"-webkit-transform": "translateX(" + transform.translateX + "px) translateY(" + transform.translateY + "px) scale(" + transform.scale + ")",
});
});
.container {
background-color: red;
width: 300px;
height: 300px;
}
.yeah {
background-color: orange;
width: 100%;
height: 100%;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://code.easypz.io/easypz.latest.js"></script>
<div class="container">
<div class="yeah">
Some content that im going to manipulate
</div>
</div>