stutrek / scrollmonitor

A simple and fast API to monitor elements as you scroll
MIT License
3.3k stars 243 forks source link

Doesn't work inside iframe on iOS (workaround found) #59

Open GordanRatkovic opened 7 years ago

GordanRatkovic commented 7 years ago

Tested with the demo page

ragefuljoe commented 7 years ago

Tested a project we're working on, and same issue, no events in iOS if iframed. Has this been acknowledged?

stutrek commented 7 years ago

If you make a PR and I'll almost definitely accept it.

ragefuljoe commented 7 years ago

@GordanRatkovic Dunno if you ever figured it out, but for anyone else having this issue, it is not problem with scrollMonitor, but rather how ios safari handles iframes.

The iframe size is not properly sized, and just ends up taking up the entire content size. This causes the animations to all be "in view" at load.

Solution is to wrap all of the content in the iframe src (not in iframe) and give this wrapper the style #wrap { position: fixed; top: 0; right:0; bottom:0; left: 0; overflow-y: scroll; -webkit-overflow-scrolling: touch; }

@stutrek I think this issue can be closed

stutrek commented 7 years ago

Thanks for figuring it out. I'll leave this issue open for anyone else with this problem.