I am creating question, when a user clicks the yellow box, text “correct” will appear. I want to make settings, that text “correct” should disappear after 3 seconds. How can I make this happen.
Set up an on click event handler for the yellow box.
-
Right click on the yellow box.
-
Click view properties.
-
Name the elements id “yellowBox”
-
Click the onClick event handler which will automatically put an event handler in your code.
For the text name the id “correctText”
The code should look like this.
let fadeOptions = {
"duration": 1000
};
export function yellowBox_click(event) {
$w("#correctText").show();
setTimeout(function delay () {
$w("#correctText").hide("fade", fadeOptions);
}, 3000)
}
Hopefully that was helpful!
Hello, thanks for the answer. It is working fine.
Code worked in this order for me.
export function yellowBox_click(event) {
$w( “#correctText” ).show();
setTimeout( function delay () {
$w( “#correctText” ).hide( “fade” , fadeOptions);
}, 3000 )
}
let fadeOptions = {
“duration” : 1000
};
I’m glad I was able to help!