EasyPZ在div上摇摇欲坠

时间:2019-07-17 04:12:14

标签: javascript jquery

我们计划将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>

0 个答案:

没有答案