I wrote a small scroller in jquery. The scroller seems to work perfectly on PC and Macs. However it doesn't work on touch devices.
I guess this is due to mousedown
property being called. how do I make this work on both PC and touch screen devices?
Thanks
$('.scroll-nav-up, .scroll-nav-down').live('click', function(){
$('.scroller-wrap').stop();
return false;
});
$('.scroll-nav-up').live('mousedown', function(){
$(this).closest('.item').find('.scroller-wrap').animate({
top: -($(this).closest('.item').find('.scroller-wrap').height() - 250)
}, 800);
});
$('.scroll-nav-down').live('mousedown', function(){
$(this).closest('.item').find('.scroller-wrap').animate({
top: 0
}, 800);
});
Nothing special found, so at this moment I am using 2 scripts. The first script identifies the the touch screen devices as written by Alastair Campbell on Detecting touch-based browsing.
and then use the
mousedown
event for regular browsers and usetap
event for touch screen devices.P.S - Using both jQuery and jQuery Mobile
If you're using jquery mobile try handling its new events
tap
andtaphold
http://jquerymobile.com/demos/1.0a2/#docs/api/events.html
I can't test it, so it's just an idea (I'm not sure if I understand what your app does), but you can try and change click to mouseup event.