Show/Hide multiple elements on same page


(Sarah) #22

Hi DBear, Thanks so much for these uploaded file… I’m new to Hype and trying replicate what you’ve done with the timeline sample in this example.

How did you change the inner HTML text to be different on each timeline? Everytime I change it in the document I’m working on, it seems to be reflected across all the different timelines?


#23

@Slinky82

I’m going to step in here for a second or so… (referencing @DBear’s example: “changeTextBoxOnClick.hype” a few posts above.)

Each timeline (“reveal1”, “reveal2”, “reveal3”) has its own “innerHTML” property for the “Description” text element. Please see “Fig.1” below.

Note that the “Main Timeline” does not have the “innerHTML” property set for the “Description” element.

Clicking on a button in @DBear’s example triggers the corresponding timeline.
(e.g. “Button 1” plays timeline “reveal1”.)

Fig.1
revalTimelines


(Sarah) #24

Thanks Jim! Will you look at that - I hadn’t even thought to look in that section - a whole new world of possibilities has opened up!!


(Loves Hype) #25

You can avoid all the problems using classes instead of IDs because they can be reused across Alle layouts and scenes without changing the ID all the time. ID’s have the downside that they have to be unique across the whole page … and hype even though it has scenes lives on only one page only .

Have a look at hypeDocument.setInnerHtmlByClass


(Sarah) #26

Thanks Max, I’ll take a look!