-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I'm using onClientInfo to get the browser size of user, then automatically adjust the window size accordingly. But it seem to only execute once. When the window is opened for second time, its back to default height/width value. Any ideas?
Here is a sample code:
zkfiddle.org/sample/qdjc2o/2-screen-auto-adjust#source-3
onClientInfo
is triggered initially and when the screen resizes.
So I am surprised it calls even at first when you click the button.
Maybe that's a bug. So when resizing your method is called every time, which is expected. (you can read the details here: https://www.zkoss.org/wiki/ZKDeveloper'sReference/UIPatterns/BrowserInformationandControl)
Anyway in order to automatically resize the window you don't need this event at all. I'd just use CSS:
<window ... style="width: 50vw; height: 50vh;">
In this case the window will size to 50% of the viewwidth/viewheight automatically. Here your updated zkfiddle:
http://zkfiddle.org/sample/qdjc2o/3-screen-auto-adjust#source-3
Asked: 2019-11-14 08:13:29 +0800
Seen: 13 times
Last updated: Nov 14 '19