Skip to Content
avatar image
Former Member

Initiating a Responsive Layout

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?

Thanks!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    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 session.info.clientWidth to know the width you can work with.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

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