最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
功能强大的Android滚动控件RecyclerView
时间:2022-06-25 23:21:42 编辑:袖梨 来源:一聚教程网
//图片手势放大 varreqAnimationFrame = (function() { returnwindow[Hammer.prefixed(window,'requestAnimationFrame')] ||function(callback) { window.setTimeout(callback, 1000 / 60); }; })(); varel = $('img'); varticking =false; vartransform; varinitScale = 1; var_eImg =''; for(varm = 0; m < el.length; m++) { varmc =newHammer.Manager(el[m]); mc.add(newHammer.Pan({ threshold: 0, pointers: 0 })); mc.add(newHammer.Swipe()).recognizeWith(mc.get('pan')); mc.add(newHammer.Pinch({ threshold: 0 })).recognizeWith(mc.get('pan')); mc.on('panstart panmove', onPan); mc.on('pinchstart pinchmove', onPinch); mc.on('swipe', onSwipe); } functionresetElement() { el.addClass('animate'); transform = { translate: { x: 0, y: 0 }, scale: 1, angle: 0, rx: 0, ry: 0, rz: 0 }; requestElementUpdate(); } functionupdateElementTransform() { varvalue = ['translate3d('+ transform.translate.x +'px, '+ transform.translate.y +'px, 0)','scale('+ transform.scale +', '+ transform.scale +')','rotate3d('+ transform.rx +','+ transform.ry +','+ transform.rz +','+ transform.angle +'deg)']; value = value.join(' '); if(_eImg !='') { _eImg.style.webkitTransform = value; _eImg.style.mozTransform = value; _eImg.style.transform = value; //_eImg.css({ 'transform': value }, { '-webkit-transform': value }); } ticking =false; } functionrequestElementUpdate() { if(!ticking) { reqAnimationFrame(updateElementTransform); ticking =true; } } functiononPan(ev) { el.removeClass('animate'); transform.translate = { x: ev.deltaX, y: ev.deltaY }; } functiononPinch(ev) { if(ev.type =='pinchstart') { initScale = transform.scale || 1; } el.removeClass('animate'); transform.scale = initScale * ev.scale; requestElementUpdate(); _eImg = ev.target; return_eImg; } functiononSwipe(ev) { varangle = 10; transform.ry = (ev.direction & Hammer.DIRECTION_HORIZONTAL) ? 1 : 0; transform.rx = (ev.direction & Hammer.DIRECTION_VERTICAL) ? 1 : 0; transform.angle = (ev.direction & (Hammer.DIRECTION_RIGHT | Hammer.DIRECTION_UP)) ? angle : -angle; requestElementUpdate(); _eImg = ev.target; return_eImg; } resetElement();
相关文章
- 王者荣耀侦探能力大测试攻略 王者荣耀侦探能力大测试怎么过 11-22
- 无期迷途主线前瞻兑换码是什么 11-22
- 原神欧洛伦怎么培养 11-22
- 炉石传说网易云音乐联动怎么玩 11-22
- 永劫无间手游确幸转盘怎么样 11-22
- 无期迷途主线前瞻兑换码是什么 无期迷途主线前瞻直播兑换码介绍 11-22