Detect current layout and Jump to scene in same layout

I have a Hype document that has 6 scenes and 4 layouts for each scene. I have a button in each scene that allows the user to go to a layout. If the user then progresses to the next scene the document resizes to the layout that is appropriate for the viewport of the device being used.

I need to keep the user in the same layout as they decide to progress.

I think that I need to detect and store the layout (hypedocument.currentLayoutName() ) and have that available to the document and then create a function that does 2 things. Goes to the next scene and stay in the same layout.

I am not sure how to structure this though - I have only used very basic functions in Hype so far.

Thanks in advance for any assistance.

you can force a layout when requested:

1 Like

Thank you for the response Hans!

I think that maybe in the Head HTML I need to detect the currentLayout and then use an event listener to force the layout the user is on in the callback? Does this seem like it might work?

yes ... should work. though I'm not aware of your setup and why your opinion is that this is the desired way to solve your problem ...

I am creating a file that I can upload as I am still not able to get this working.

and please consider to simplify an exampledocument as much as possible ... so it'll be self-explanatory to people trying to help :slight_smile:

Still looking for a solution to keep a user on a specific layout as they progress through scenes of a hype document. I created this simple example to help anyone that has the time to take a look, help understand.

Basically if there are several scenes and several layouts for each scene, and the ability to switch between layouts. If the user does switch to a specific layout - I want them to remain within that layout as they move to the next or previous scene.

I understand that if there is a resize the scene with change to the correct viewport version.

Thanks in advance.

stayOnLayout.hype.zip (341.7 KB)

stayOnLayout_fixed.zip (348.2 KB)

not well tested ...

1 Like

Works great, sir!

@h_classen solution should be on point. Just wanted to add this resource based on the same Hype Event to the thread. I stopped the idea of "kits" so it hasn't been updated, but the code in it might be useful in this context Hype LayoutKit (Layout Extension)

1 Like