0

I'm creating the website where content is dynamically added using iframe (files of iframes are on the same server). Loaded iframe has buttons to scroll iframe content but I can't find a reason why it doesn't work on iPhone - it works well using Android. Here is the code I used:

$('#menu li a').on('click', function(){     
            var element = $(this).attr('data-scroll');      
            $('body').animate({
                scrollTop: $('.page[data-bookmarks=' + element + ']').offset().top
            }, 1000);
        });

Btw. click event works well, because I checked it using alert. Simply scrollTop seems doesn't work on iOS devices.

Ziggy
  • 159
  • 1
  • 10

1 Answers1

0

I found several links that might solve this issue, but the one that I ran into the most was this:

It's much easier to control overflowed divs than it is iFrames, and the scrolling + blank content issues are working all the way back to iOS 4, where previously I wasn't even able to get the 2 finger scrolling to work (in iFrames).

It goes something like this:

<iframe id="example-iframe" width="600" height="200" src="a-file.html"></iframe>

a-file.html:

<html>
<body>
<div id="wrapper" style="width: 100%; height: 100%; overflow: auto; -webkit-overflow-scrolling: touch;">
...
</div>
</body>
</html>

Other Links

Community
  • 1
  • 1
Caleb Kleveter
  • 11,170
  • 8
  • 62
  • 92