Created
December 19, 2010 09:51
-
-
Save rmdort/747229 to your computer and use it in GitHub Desktop.
Added iOS and Android Support for jScrollPane
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ipad Iphone | |
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'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment