1

Maybe you could make a javascript that scrolls the iframe on scrollwheel event? I'm not really that good at javascript though.

I found this, but I still don't know how to target the iframe and scroll it: Get mouse wheel events in jQuery?

Community
  • 1
  • 1
Kevin Nagy
  • 19
  • 3
  • Is the iframe on the same origin? Origin = scheme/host/port, so `https://example.com` can only control an iframe on `https://example.com` – Rudie Oct 19 '14 at 02:15
  • Then you can. With JS, catching the mousewheel event in the top document and change the scroll offset in the frame document. But I'm going to bed. Goodluck. – Rudie Oct 19 '14 at 02:18

1 Answers1

0

Here you are : http://jsfiddle.net/dsmeuzL5/

HTML :

<iframe id="myframe" src="//www.yourpage.com"></iframe>

JS : var iframe = document.getElementById('myframe');

var MouseWheelHandler = function (e) {
    // cross-browser wheel delta
    var e = window.event || e; // old IE support
    var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));
    console.log(delta);
    var doc = iframe.contentDocument ? iframe.contentDocument : (iframe.contentWindow ? iframe.contentWindow.document : iframe.document);
    doc.body.scrollTop = doc.body.scrollTop - (delta * 30);

    return false;
}


if (window.addEventListener) {
    // IE9, Chrome, Safari, Opera
    window.addEventListener("mousewheel", MouseWheelHandler, false);
    // Firefox
    window.addEventListener("DOMMouseScroll", MouseWheelHandler, false);
}
// IE 6/7/8
else window.attachEvent("onmousewheel", MouseWheelHandler);
GramThanos
  • 3,572
  • 1
  • 22
  • 34