scrollTop always returning 0 from iframe on iPad safari iOS

Keywords´╝Ü javascript jquery html ios iframe

Question: 

I know there are several discussions about this, but this in particular is quite specific as well.

I got a preview iframe on my page that whenever is scrolled, it has some functionality attached to the event.

But when I try to get the scrollTop on iPad Safari, I always get 0 no matter what.

I attempted many ways already without success such as:

$('#iframe').contents().scrollTop()

iframe.contentWindow.scrollY / pageYOffset

iframe.contentWindow.document.scrollingElement => returns 'body'

$('html, body').scrollTop()

$('html, body', iframe.contentWindow.document).scrollTop()

Any idea on how can I get the page scroll offset?

Answers: