Detecting scroll gestures from iframe

I load a local HTML file into an IFrame using HTML / Javascript in the Windows Store development (Windows 8). I am trying to get a Swipe event from an iframe.

I tried with this pattern and this . I applied a mouse script that contains one div element. For Iframe, this does not work.

My code is:

<body>
    <iframe  id="iframe_Id" src="split.html" style="height:768px; width:1366px;" onload="Load();"></iframe>
</body>

 

function Load() {

var elt = document.getElementById("iframe_Id");

    elt.style.backgroundColor = "#f3f3f3";
    var gobj = new MSGesture();
    // Defining gesture object for Pen, mouse and touch
    gobj.target = elt;
    elt.gesture = gobj;
    elt.gesture.pointerType = null;

    // Creating event listeners for gesture elements
    elt.addEventListener("MSPointerDown", onPointerDown, false);
    elt.addEventListener("MSGestureTap", onTap, false);
    elt.addEventListener("MSGestureHold", onHold, false);
    elt.addEventListener("MSGestureChange", onGestureChange, false);

    // Mouse Wheel does not generate onPointerUp
    elt.addEventListener("MSGestureEnd", onGestureEnd, false);

}

function onPointerDown(e) { 
 var content = document.getElementById("iframe_Id");
}

I created functions for all events. But when the swipe in my IFrame the event did not go up. I structured here. I need to work with Swipe. Please help me out of this.

+4
source share
2 answers

split.html , iframe. parent.postMessage() HTML- /.

, WebView, HTML/JavaScript Windows 8.1.

+5

<iframe> <div>, :

<body>
   <div id="watch">
       <iframe id="iframe_Id" src="split.html" style="height:768px;
       width:1366px;" onload="Load();">
       </iframe>
   </div>
</body>

div#watch iframe, DOM, iframe.

+3

All Articles