Fórum Fórum

Vissza

How to target a particular layout using onLayoutChange

Váltás
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 Szavazatok)

RE: How to target a particular layout using onLayoutChange
Válasz
2024.01.16. 17:24 válaszként erre: 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 Szavazatok)

RE: How to target a particular layout using onLayoutChange
Válasz
2024.04.24. 18:04 válaszként erre: 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 Szavazatok)