'Linking' text between different layouts?


(Sarah) #1

Hello,

I am trying to figure out how to link my text between different layouts for desktop / phone / ipad etc. I found this post Is there a way to link text in different layouts
which mentions using dynamic content, but despite searching the forums as suggested, I can’t seem to find anything that describes this.

My JS knowledge is rudimentary, so any guidance anyone could give would be greatly appreciated!

Many thanks!


(Rick) #2

Searching for ‘dynamically add text’ results for me a bunch of hits like:

or:


(Sarah) #3

Thanks for taking the time to reply, Rick. I did come across those, and many others, in my searches across the forum but they unfortunately didn’t make it any clearer (to me at least!). I’m not looking to import content from a text file, and when I looked at that template, it seemed focused on creating an interactive quiz? From what I’ve read it seems like there may be a way to replicate the inner html from one text box to another using element ID and javascript, but I feel like I’m missing something? Any help you would give would be greatly appreciated!


(Mark Hunte) #4

A css hack,

Give the text elements the same class.

Then instead of adding text to the elements via editing the inner HTML use css content in the head file.

<style>
  .content1::after{

content: " CONTENT LINKED VIA CSS One" !important;


 }
 
  .content2::after{

content: " CONTENT LINKED VIA CSS Two" !important;


 }
 
 
 
</style>

The nice thing about this is the text shows in Hype scene editor straight away due to hype seeing the css in the head file

The Hack part is that the css content needs to be either after or before any existing text. But as I say above we do not need to add any text in the text boxes. the content::after will still work.

cssContent.hype.zip (37.8 KB)


(Sarah) #5

Thanks Mark! This is indeed a neat trick, and great to know about! I’m going to have about 30 pages, each with different content, so I think in my case this might become a little complicated for my scenario.


(Mark Hunte) #6

No problem.

But to be honest I think it is the least complicated unless the text is changing when I think about what I would likely need to do with javascript.