قالب وردپرس درنا توس
Home / IOS Development / jquery – Get scrollTo to work within iframe on iOS

jquery – Get scrollTo to work within iframe on iOS



I have a page on mysite.com that uses an iframe to extract content from subdomain.mysite.com. I use the iframe resizer script (https://github.com/davidjbradshaw/iframe-resizer) to ensure that the height of iframe always matches the height of the content. Works as a charm browser / OS.

Within iframe is a long form of client-side validation. If the user tries to submit the form and is not fully validated, I use scrollTo (on the form page within the iframe) to scroll the page to the top of the form where they are presented with a detailed error message. This works well over desktop browsers (Mac and Windows) and on all Android devices – w / r / t scrollTo scroll to the top of the form in iframe.

But iOS does not work ̵

1; scrolling to the top of the form that is in iframe does not happen. I have read about how, since 2011, on iOS you have to turn on the ability of iframe to be rolled – I'm not sure if this would solve my problem. I'm reading about adding style = "overflow: auto; -webkit-overflow-scrolling: touch;" to div that surrounds iframe, and tried this, but it had no impact.

I can not tell yet if I have not found the right solution to make this work in iOS, or if there is no way for scrollTo to work in an iframe when you are in iOS. Mind?


Source link