I am trying to hide the element in desktop and I am able to do so but element are also gets hidden in mobile version.
some time it appears some time it doesn't if I reload page two to three time it shows up on the mobile
here is the code which I use. I used this code on every page but on some pages some elements get disappear on live site & on some page all element get disappear and also on some page every element is showing up and there no code except this one.
This code I take from wix article https://support.wix.com/en/article/how-to-use-wix-code-to-display-elements-in-mobile-only
import wixWindow from 'wix-window'; $w.onReady(function () { if(wixWindow.formFactor === "Mobile"){ $w("#your_first_element's_ID").show(); $w("#your_second_element's_ID").show(); } });
This is my code ---
import wixWindow from 'wix-window';
$w.onReady( function () {
if(wixWindow.formFactor === "Mobile" &&
wixWindow.rendering.renderCycle === 1) {
$w("#gallery1").show();
$w("#button17").show();
$w("#box6").show();
$w("#box9").show();
$w("#box1").show();
$w("#box8").show();
$w("#box3").show();
$w("#box2").show();
$w("#box10").show();
$w("#googleMaps1").show();
$w("#your_second_element's_ID").show();
}
} );
Please check my site
my site is orooms.in
there are many pages which are affected but this is the one of them which is having issue - https://www.orooms.in/location-kota
on page also I put same code but it is working fine on mobile
On desktop all element get hidden but on mobile also its getting hidden
I would try removing the render cycle and see if that makes a difference. It’s possible sometimes when you load it’s using backend render cycle and other times the front end, which causes the code to sometimes work and other times not.
Hi Rishabh,
Did you ever get an answer on this? I have the same problem. I see a lot of similar posts, but no real answers.
Thanks,
Bobby