locked
Windows 8 Touch in Javascript Navigation Application RRS feed

All replies

  • Hi pol,

    If I understand your scenario correctly you can absolutely do this, and there is somewhat of a sample to help you:

    http://code.msdn.microsoft.com/windowsapps/Input-DOM-pointer-and-2e5697ed

    Instead of using <a> (or if you still wish to use it, use the <a> and set the href = javascript:void(0)", use a <div> for your content:

    <div class="gestureElement">My Content I want to implement touch gestures on</div>

    Then for example, get the element(s) by class name and add the events.  These events have a lot of detailed arguments so do inspect these

     

    var guestureElement= document.getElementsByClassName("gestureElement")[0];

    gestureElement.addEventListener("MSGestureChange", ongestureElementGestureChange, false);
    gestureElement.addEventListener("MSGestureTap", ongestureElementGestureTap, false);
    gestureElement.addEventListener("MSGestureEnd", ongestureElementGestureEnd, false);
    gestureElement.addEventListener("MSGestureHold", ongestureElementGestureHold, false);

    Let me know if you need more detail or if I got your scenario wrong.

    Patrick Dengler - Microsoft

     
    • Proposed as answer by Pan Chan Friday, May 25, 2012 7:28 AM
    Thursday, May 24, 2012 4:46 PM
  • hi patirck, thanks for the prompt reply. i will definitely try your suggestion and will post a feedback soon here. thanks!
    Friday, May 25, 2012 12:52 AM
  • hi there patrick, i went to your suggested link and downloaded the sample project. the problem is i'm quite lost with the codes.

    i hope you can find some time with more detials to help me with your presented solution. thank you.

    -pol

    Friday, May 25, 2012 3:43 AM