I’m designing a navigation bar for a tablet website. The navigation bar holds elements displayed horizontally, and I want to be able to display new elements with a swipe (kind of like a cover flow) without the window moving. This is the code I’m using now (jQuery Mobile):
//Tablet Features
$('#navHolder').bind('swipe',
function(e) {
$('#navHolder').animate({left:thisLeft - 100});
}
);
I dont think I can trigger a swipe without first disabling scroll, but I’m open to all suggestions. Please help.
Set the parent container of the element you are scrolling to
overflow : hiddenso no scroll-bars appear. Thenswipeevents should work fine since you won’t be able to use native scrolling to scroll the content.HTML —
CSS —
JS —
Here is a demo: http://jsfiddle.net/B8PQn/1/