_oren
1
Hi,
I’m working on a page in my site:
https://www.wixmeup.co.il/build-site
I added a code that allows the functions to run only when i’m on desktop.
I saw that this code also run on mobile.
This is code:
if (wixWindow.formFactor === “Desktop”) {
}
Can someone tell me why the code also run on mobile?
_or
2
Hi,
Your code is placed between the brackets? Please share some more code so we can inspect.
_oren
3
This is all of my code:
import wixWindow from ‘wix-window’;
$w.onReady( function () {
if (wixWindow.formFactor === “Desktop”) {
$w(‘#columnStrip111’).collapsed;
$w(‘#imgLogoRegular’).hide();
$w(‘#socialBarWhite’).hide();
}
});
export function header1_viewportEnter(event) {
if (wixWindow.formFactor === “Desktop”) {
console.log(“this is Desktop”);
let fadeOptions = {
“duration”: 500,
“delay”: 0
};
$w(‘#columnStrip111’).hide(“fade”, fadeOptions);
$w(‘#imgLogoRegular’).hide(“fade”,fadeOptions);
$w(‘#horizontalMenuColor’).hide(“fade”,fadeOptions);
$w(‘#socialBarGray’).hide(“fade”,fadeOptions);
$w('#imgLogoBW').show("fade",fadeOptions);
$w('#horizontalMenuBW').show("fade",fadeOptions);
$w('#socialBarWhite').show("fade",fadeOptions);
}
}
export function header1_viewportLeave(event) {
if (wixWindow.formFactor === “Desktop”) {
let fadeOptions = {
“duration”: 500,
“delay”: 0
};
$w(‘#columnStrip111’).show(“fade”,fadeOptions);
$w('#imgLogoRegular').show("fade",fadeOptions);
$w('#horizontalMenuColor').show("fade",fadeOptions);
$w('#socialBarGray').show("fade",fadeOptions);
$w('#imgLogoBW').hide("fade",fadeOptions);
$w('#horizontalMenuBW').hide("fade",fadeOptions);
$w('#socialBarWhite').hide("fade",fadeOptions);
}
}