Mobile vs desktop trigger

Hey, I’m trying to set up an action button with logic trigger to show a different component depending on if they’re viewing in desktop or mobile. I’m not 100% how best to set this up though. Any advice would be much appreciated!

Hi @emily.c.humphreys
Do you definitely need an action button to do that? There’s a logic trigger even called ‘Device size changed’ you could set up 2 triggers - one for desktop, one for mobile. Then set the action to show the relevant component and hide the other one for each. Like this:


also, good timing as just released the device switcher feature for live preview today (you can find it in the top right of the live preview window) so you can test its working as you would expect.
Cheers-Sam

thanks! I’ve figured out how to do it with action buttons but did not know this options existed - so much easier! yeah the new live preview is very helpful for testing this.
cheers, Em

1 Like

@Sam_Cook_Evolve_QA Probably a dumb question, but the trigger you’re suggesting is device changed but I’m trying to understand that scenario. On a desktop/laptop, that would be a browser size change or something that would trigger the responsive behaviors. On a phone, there wouldn’t be a device change. I think @Emily.Humphreys was looking for a way to detect which device the learner was on from the get-go, right? Or at the time of the action button click/tap. Can you differentiate for me between something that checks viewport size changes versus something that just detects the device currently in use. Thanks

@Martin having tried it out now I think it’s not so much that it is triggered by a change in device size. Rather, it changes what the learner sees based on the device size.

@Sam_Cook_Evolve_QA will using this effect some course completion settings if there are effectively hidden components that learners won’t interact with depending on their device?

@Martin I think it’s just a case of a badly worded Event - it should just be ‘Device size’ really - I will see if I can get that changed.

@emily.c.humphreys it’s entirely dependent on how your course completes. If you are using the Course Attainment Extension, I would omit that set of components from the completion criteria. If you are completing via an assessment and these components don’t feature in that assessment, then it wont be a problem. As an alternative you could have an action button set to trigger completion on the last page, or a logic event.

2 Likes