100% new user : how to hide and show a text by pressing a button :-/


(R) #1

Hi all !

I’m trying hard. I read docs. But I need help:

I have a text and two buttons.
How to hide the text when I press the left button and to re-show the text when I press the right button ?

Thanks a lot !


(Greg) #2

Here’s how to hide it, set up a new button to do the opposite (opacity 0% to 100%)

HINT : I set up a new timeline to change the text’s opacity from 100% to 0%

hideText.hype.zip (10.4 KB)


(Ken Judge) #3

Hi Eric,

Looking at the question if this is to show and hide an object like a menu, I have just that by simply adding JQuery.js as a resource to your Hype Project and make sure the Tick Box on the file is set to include in the header.

Click on the Text and select the (i) Identity Icon and set the Unique Element ID to ‘text1’ for example, then all you need to do is select only one button, Again make sure your Unique Element ID in the Identity Tab is set to Button1

Then on the Click Event of the ‘button1’ select Run Javascript and Crete a New Javascript Function, Name the Javascript Function ToggleMenu for example or whatever you like, and then the only line you need to add to the function is ;

$("#text1").fadeToggle(1000);

The (1000) means it will take 1 second to fade in and fade out by clicking the same button repeatedly.

Hope this helps as an alternative to using the Timeline and 2 buttons to show/hide an object.

Regards

JudgeyK


(R) #4

@ Greg & Ken

Thanks a lot for your help !
Now I understand better.
I’ll try to start my first tests with your examples tonight.