0

Scenario: I have an html page named main.html with 3 iframes with id's as left, middle and right.

We have 3 separate html pages named leftsection.html, middlesection.html and rightsection.html.

The left iframe points its src to leftsection.html, middle iframe points to middlesection.html and right iframe pointing to rightsection.html.

All the three iframes have their respective scrollbars and data is loaded dynamically using lazy loading. Here I need to invoke method1 on scroll of left iframe, method2 on scroll of middle iframe and method3 onscroll of right iframe.

Issue: How to invoke method1 onscroll of left iframe, method2 onscroll of middle iframe and method3 onscroll of right iframe?

Note:

The scroll bar used is a jQuery scroll bar and not the default scrollbar.

Any help would be great.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Dev
  • 410
  • 5
  • 23
  • the example at the bottom of http://api.jquery.com/scroll/ shows how scrolling the iframe gets detected inside the iframe, but you need to invoke a method in the parent page? – flup Oct 27 '14 at 11:32

1 Answers1

0

You need to bind events on those scrollbars, but problem is that they reside in iframe which can't be accessed from default like $('iframe .scrollbarDiv') as it's in different window context.

To access this iframe you need to follow How can I access iframe elements with Javascript?

Community
  • 1
  • 1
Szymon Toda
  • 4,454
  • 11
  • 43
  • 62