Scrolling a div with touch events
How can I scroll a div with touch events? I have a DIV with overflow set to hidden. I know I can scroll a DIV with javascript, here is an example for using the mousewheel:
function mousewheelScroll(event, delta) {
var $t = $(this);
var change = delta * 8;
var top = $t.scrollTop();
top = top - change;
if (top < 0)
top = 0;
if (top > ($t.attr("scrollHeight") - $t.innerHeight()))
top = ($t.attr("scrollHeight") - $t.innerHeight());
$t.scrollTop(top);
}
But i haven't found an exam开发者_JS百科ple that will work with touch events for iOS devices.
Check out this plugin, it seems like it's just what you're looking for
http://plugins.jquery.com/project/touch-scroll
精彩评论