nin
March 1, 2020, 10:38pm
1
Hi all,
I have no idea how to make a code to do the following:
I have made my website using WIX. I would like to make a text line more “dynamic”. The only thing I want this text to do is to switch from 1 second ON to 1 second OFF , I mean, this text has to be visible 1 second and disappear another second, in an infinite loop.
Could anyone help me with this?
Thanks in advance!
J.D
March 1, 2020, 10:56pm
2
$w.onReady(() => {
setInterval(() => {
$w("#text1").hidden ? $w("#text1").show() : $w("#text1").hide();
}, 1000)
})
nin
March 2, 2020, 8:08am
3
Thanks a lot!! It works perfectly
Can you combine this code for 3 text boxes for example so there would be a loop for three words in the same place?
For example text: Vegetables of the day are TOMATO/ONION/CARROT and this uppercase are showing in the loop one after another.
Thanks in advance!
J.D
May 20, 2021, 10:01am
5
@rudjersimek
You can do something like:
let vegs = ["TOMATO", "ONION", "CARROT "];
const intevalInSeconds = 1;
let currentVeg = 0;
$w.onReady(() => {
setInterval(() => {
$w("#text1").text = vegs[currentVeg];
currentVeg = (currentVeg + 1) % vegs.length;
}, intevalInSeconds * 1000);
})
@jonatandor35 This is great! Thank you very much!
Hi, how can I do this but have the transition between text be ‘fade’?
J.D
November 17, 2021, 9:16pm
8
$w.onReady(()=> setInterval(()=> { $w("#text1").hidden ?$w("#text1").show('fade'):$w("#text1").hide('fade');} ,1000));