if (wixWindow.formFactor === "Mobile"){
let total = 6;
for (let i = 1; i < total; i++){
total = i;
$w("#group +{total}+ ").show();
if (i === 6 ){
i = 1;
}}}
*** And if someone can help me understand how set time to loop !
Hi,
You need to use backticks: **${variableName}** . I’ve corrected the code for you:
if (wixWindow.formFactor === "Mobile"){
let total = 6;
for (let i = 1; i < total; i++){
total = i;
$w(`#group${total}`).show();
if (i === 6 ){
i = 1;
}
}
}
As for your second query, I’m not sure that I fully understand what you were referring. Can you please clarify what is the scenario?
i meant time to do a loop, for example every 4 second it would loop once.
if (wixWindow.formFactor === "Mobile") {
let total = 6;
for (let i = 1; i < total; i++) {
total = i;
$w(`#group${total}`).show();
if (i === 6) {
i = 1;
}
},4000
}
if (wixWindow.formFactor === "Mobile"){
var i = 2;
function myLoop () {
setTimeout(function () {
$w("#group1").hide();
$w("#group2").hide();
$w("#group3").hide();
$w("#group4").hide();
$w("#group5").hide();
$w("#group6").hide();
$w("#group7").hide();
if (i === 8){
i = 2;
}
$w(`#group${i}`).show();
i++;
if (i <= 8) {
myLoop();
}
}, 3000);
}
myLoop();
}