0

onClientInfo is not working as expected. Bug?

asked 2019-11-14 08:13:29 +0800

iliyar gravatar image iliyar
1

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

delete flag offensive retag edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-11-14 09:47:03 +0800

cor3000 gravatar image cor3000
6280 2 7

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

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2019-11-14 08:13:29 +0800

Seen: 13 times

Last updated: Nov 14 '19

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More