Forum Forum

Retour

How to target a particular layout using onLayoutChange

Bascule
Hi,

I am trying to change the font scale specifically for a phone layout.

I see there is a action block for "onLayoutChange" but I cannot see a way to target a specific layout - e.g. `If layout is "Phone Portrait" then scale = 50`

Many thanks in advance for any help given.
0 (0 Voter)

RE: How to target a particular layout using onLayoutChange
Réponse
16/01/24 17:24 en réponse à Leon R.
Hi Leon,
This is possible... sort of. I'm not sure I would recommend it, though. See attached image. Basically, WHEN the layout changes, you can get the name of the new layout. But if the learner starts viewing the lesson in Phone Portrait Layout, then the onLayoutChange Event never happens, right? And onPageChange doesn't pass this same event. So it's not very reliable for this purpose.

Instead, I'd recommend 2 separate text objects that have the same text in them, but at your desired sizes, and place the one you don't want off screen (when in Phone-Portrait-Layout have the Phone-Portrait-text on the page, and the Default-Layout-text offscreen, and vice versa).

Hope that helps!
0 (0 Voter)

RE: How to target a particular layout using onLayoutChange
Réponse
24/04/24 18:04 en réponse à Navdeep Dhillon.
Hi Leon (and anyone else watching this post),
A hidden feature in our latest update (inspired by this forum post) was to include the Layout name as the event parameter as part of the page.onLoad trigger. See this forum post for a similar use case using the page.onLoad and page.onLayoutChange triggers - https://portal.smartbuilder.com/web/smartbuilder/forum/-/message_boards/message/610505
0 (0 Voter)