JSCROLLPANE IPAD/IPHONE/IPOD/IOS SCROLL/ANDROID支持
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JSCROLLPANE IPAD/IPHONE/IPOD/IOS SCROLL/ANDROID支持相关的知识,希望对你有一定的参考价值。
From http://snipplr.com/view/41051/jscrollpane-ipadiphoneipodios-scoll-support/ here the part of code to add in jScrollPane.js for android,iphone,ipod,ipad support. Add this after :if (isScrollable) { (around line 165)
// Ipad, Iphone, Ipod and Android support if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)) || (navigator.userAgent.match(/Android/i))) { var isTouchScreen = 1; }else{ var isTouchScreen = 0; } $container.bind('touchstart', function(e){ var cpos = dragPosition; if(isTouchScreen){ e = e.originalEvent.touches[0]; } var sY = e.pageY; var sX = e.pageX; $container.bind('touchmove',function(ev){ if(isTouchScreen){ ev.preventDefault(); ev = ev.originalEvent.touches[0]; } var top = cpos-(ev.pageY-sY); positionDrag(top); }); $container.bind('touchend',function(ev){ $container.unbind('touchmove touchend'); }); });
以上是关于JSCROLLPANE IPAD/IPHONE/IPOD/IOS SCROLL/ANDROID支持的主要内容,如果未能解决你的问题,请参考以下文章