/ Published in: jQuery
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)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// 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'); }); });