triceam / app-UI

app-UI is a collection of user interface components that may be helpful to web and mobile developers for creating interactive applications using HTML and JavaScript, especially those targeting mobile devices. app-UI is a continual work in progress - it was born out of the necessity to have rich & native-feeling interfaces in HTML/JS experiences, and it works great with PhoneGap applications (http://www.phonegap.com). app-UI can easily be styled/customized using CSS.
http://triceam.github.com/app-UI/
Other
1.27k stars 239 forks source link

touchstart in App UI slidingview #26

Closed danielbwa closed 12 years ago

danielbwa commented 12 years ago

Hey Andrew,

I'm working on a small app and i used App UI "sliding view" as a start to have a fb style side menu. While working on this i have a small issue: I have a gallery (swipeview) in the #body div. The touchstart event from app UI is observing a swipe in the #body div so now when i swipe in my img gallery the side menu gets triggerd..

Any idea on how i can make the slidingview.js a bit smarter so it doesn't show the menu on a swipe in the gallery (swipe in the div#slider)? the div #slider is in the #body div so its good that the swipe event gets triggerd but i would like to disable it for the #slider div.

triceam commented 12 years ago

Assuming you are using the SwipeView from here: http://cubiq.org/swipeview

You have to change the SwipeView class to cancel the default actions on the start event. I just added three lines in swipeview.js. Inside of the handleEvent function, I added "preventDefault()", "stopPropagation" and "return fale" in the startEvent case:

case startEvent: this.__start(e); e.preventDefault(); e.stopPropagation(); return false; break;

Here's an example showing it in action: http://triceam.github.com/app-UI/examples/samples/03%20-%20slidingView/03%20-%20swipeview/

and the source is here: https://github.com/triceam/app-UI/tree/master/samples/03%20-%20slidingView/03%20-%20swipeview

triceam commented 12 years ago

That fix prevents the touch/mousedown events from swipeview from propagating to the sliding view container

danielbwa commented 12 years ago

Thank you Andrew!

This is exactly what i needed!

2012/8/28 Andrew Trice notifications@github.com

That fix prevents the touch/mousedown events from swipeview from propagating to the sliding view container

— Reply to this email directly or view it on GitHubhttps://github.com/triceam/app-UI/issues/26#issuecomment-8076015.

samialsaeh commented 10 years ago

Hey Andrew

Is it possible to open the SlidingView menu when i click on a button?