interact实现手机端手指触碰效果,包括单点、双击、长按、旋转
代码语言:html
所属分类:拖放
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>BFW NEW PAGE</title> <script id="bfwone" data="dep=jquery.17&err=0" type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/bfwone.js"></script> <script type="text/javascript"> bready(function() { use(["interact.min"], function() { interact('.tap-target') .on('tap', function (event) { event.currentTarget.classList.toggle('switch-bg') event.preventDefault() }) .on('doubletap', function (event) { event.currentTarget.classList.toggle('large') event.currentTarget.classList.remove('rotate') event.preventDefault() }) .on('hold', function (event) { event.currentTarget.classList.toggle('rotate') event.currentTarget.classList.remove('large') }) var angle = 0 interact('#rotate-area').gesturable({ onmove: function (event) { var arrow = document.getElementById('arrow') angle += event.da arrow.style.webkitTransform = arrow.style.transform = 'rotate(' + angle + 'deg)' document.getElementById('angle-info').textContent = angle.toFixed(2) + '\u00b0' } }) }); }); </script> <style.........完整代码请登录后点击上方下载按钮下载查看
网友评论0