-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello everybody,
first of all i wish everyone a happy new year. Now my problem...
I have integrated an input form in an iframe on a foreign page. After checking the input in the controller, I would like to bring the beginning of the iframe back into the display area, but Clients.scrollIntoView doesn't work.
How can I scroll the parent window up so far that the beginning of the iframe comes back in the visible area?
Thank you for your help! Andi
I'd say scroll into view works, it just doesn't do what you expect. My guess: it can only affect the scroll position inside the iframe, if the iframe doesn't have a scrollbar, then there's nothing to scroll, and it won't change the scroll position of the outside page. You didn't provide any details on how it "doesn't work" on your side. If you have any error messages or description of the failing behavior that might help as well.
My idea would be to tell the outer page to update the scroll position. E.g. using the web api window.postMessage() which is dedicated to cross origin inter window/frame communication.
However without your actual code it's hard to perform tests dedicated to your actual problem, and suggest something more concrete.
You're right, the iframe doesn't have a scrollbar, then there's nothing to scroll! The scroll position of the outside page would have to be changed. I found a very simple solution to scroll the outside page by inserting an input field at the beginning of the iframes and focusing on it. Thus the beginning of the iframe comes into view again.
Asked: 2020-01-06 20:15:28 +0800
Seen: 14 times
Last updated: Jan 07 '20
[Announcement] ZK 8.5.1 is now available!
Highlight new release changes/new features in demo app
How can I make a button change its image by clicking on the same button?
Problems calling function 'sec:isAnyGranted' with zkspring 3.2 and Spring Security 4
webapp folder of ZK spring boot?
Can I set in runtime a new value to library property: org.zkoss.zk.ui.processMask.enabled:
Package ZK Eclipse Tomcat Project For Deployment
AImage org.zkoss.zk.ui.UiException: java.io.FileNotFoundException