Skip to Content

Initiating a Responsive Layout

Feb 08, 2017 at 10:14 PM


avatar image
Former Member

I'm creating a Persona using Personas 3.0 - this persona has a bunch of content blocks that are left-aligned when the screen loads.

I've successfully created a script and attached it to the onResize screen event, so that every time the screen is resized the content blocks are centered rather than left-aligned.

However, I can't figure out how to get this script to run when the user lands on the screen. I've tried attaching the script to onLoad, onEnter, onBeforeRefresh, and onAfterRefresh, but none of these work. So, I'm stuck in a frustrating situation where the layout looks good after the user resizes the window, but doesn't look good if the user does not resize the window.

Has anyone else solved this issue? Which screen event should I use to get the desired behavior?


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Tamas Hoznek
Feb 08, 2017 at 11:25 PM

onLoad should work... are you saying that if you attach the script to onLoad, it doesn't get triggered?

If you are using the width or height implicit variables in your calculation, then keep in mind that they are only available in the onResize event. So for onLoad, you should use session.findById("wnd[0]/usr").width or to know the width you can work with.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks - the issue was, as you said, that I was just using the "width" variable and not correctly identifying the window.

Former Member

Also, it's worth noting that worked, but session.findById("wnd[0]/usr").width yielded an error when used with onLoad.