domhammer
v1.0.3
Published
控制DOM结构移动、缩放、旋转的集成方法,支持鼠标开启部分功能操作;Move, zoom, rotate the mobile device DOM element, then output the total amount of change.Pc device partial support.
Downloads
9
Maintainers
Readme
domhammer.js
It is an external method that integrates the functionality of the hammer.js. It is mainly used in mobile touch device, and the pc devices also supports incomplete functions.Provides output of the total output value of the moving, scaling and rotating functions of the selected element object on the DOM structure.The zoom function on the pc device is turned off by default. If you need to enable the parameter to be set to (true), the premise is that there is support for the mouse scroll event.
There must be a hammerjs dependency package in the module, and there is no need to require it again in the process of project development.
In order to achieve good device compatibility, the js startup file can add the
screen-pl
requirement module.System Support: Mobile browser kernel Android4.4+ 、ios ;Pc browser kernel webkit、Chrome、Gecko...
Install
npm install domhammer --save
Usage
Add the requirement JS library file to the code,The output is a method that provides three parameters [obj, callbakck, boolean]
.Obj is the object chosen to run,Callback is the result of the return after running. Boolean is a unique parameter of the pc device, Controls the scaling of the obj mouse scroll event.This js also provides a method of destroying destroy(obj)
.
###JavaScript:
let domhammer= require('domhammer');
let obj = document.querySelector('div');
domhammer(obj,function(res){
console.log(res)
});
###html:
<body>
<div></div>
</body>