Hide & Show function not working

Hi, the hide(), show() functions are not working in my site. It has been working a week ago. Not only in Corvid it’s not working, in the masterpage.js it’s not working if I select hide as default. My page is highly relied on hide(), show() to distinguish a tablet & computer browser page.

And I used that function for the menu and it’s not working right now :frowning:

This is the code I’m using :

import wixWindow from 'wix-window';//at top of the code page
$w.onReady(() => {
$w("#tabletMenu").hide();
wixWindow.getBoundingRect()
  .then(winInfo => {
 let winHeight = winInfo.window.height; 
 let winWidth = winInfo.window.width; 
 if (winWidth < 1024){
      $w("#largeScreenMenu").hide();
      $w("#tabletMenu").show();
    } else {
      $w("#tabletMenu").hide();
      $w("#largeScreenMenu").show();
  }
  } );
});

$w.onReady(function () {
 // Write your code here
});

Thanks!

This is the website I’m editing: www.stepschannel . com/

Hello contact,
you have 2x $w.onReady

change your code with this

import wixWindow from 'wix-window';//at top of the code page
$w.onReady(function() => {
$w("#tabletMenu").hide();
wixWindow.getBoundingRect()
  .then(winInfo => {
 let winHeight = winInfo.window.height; 
 let winWidth = winInfo.window.width; 
 if (winWidth < 1024){
      $w("#largeScreenMenu").hide();
      $w("#tabletMenu").show();
    } else {
      $w("#tabletMenu").hide();
      $w("#largeScreenMenu").show();
  }
  } );
});

kind regards,
Kristof.

Hi Kristof,

Thanks for you reply! I have used your script but not working as well & I cant even hide elements by default :[

Cheers,
Cher

oke, can you try this code instead?

import wixWindow from 'wix-window';//at top of the code page
$w.onReady(function() => {
$w("#tabletMenu").hide();
wixWindow.getBoundingRect()
  .then(winInfo => {
 let winHeight = winInfo.window.height; 
 let winWidth = winInfo.window.width; 
 if (winWidth < 1024){
      $w("#largeScreenMenu").collapse();
      $w("#tabletMenu").expand();
    } else {
      $w("#tabletMenu").collapse();
      $w("#largeScreenMenu").expand();
  }
  } );
});

i olmost always using collapse, expand since it moves my elements to not have any spacings.
you have another element on the same place but it still might work.

or try using async await.

import wixWindow from 'wix-window';//at top of the code page
$w.onReady(async function() => {
$w("#tabletMenu").hide();
await wixWindow.getBoundingRect()
  .then(winInfo => {
 let winHeight = winInfo.window.height; 
 let winWidth = winInfo.window.width; 
 if (winWidth < 1024){
      $w("#largeScreenMenu").hide();
      $w("#tabletMenu").show();
    } else {
      $w("#tabletMenu").hide();
      $w("#largeScreenMenu").show();
  }
  } );
});

Kind regards,
Kristof.

I have the same problem on my sites. Menus which were hidden are shown now. And this functionality worked a few days ago.

I observe similar issue. I have strips which are hidden & collapsed by default. Today I see a white gap at place where the hidden & collapsed strips are located. Something related to hide/collapse functionality was broken…

Thanks Kristof!!

I have solved partially the problem by using collapse and expand. But hide/show seems still not working even though I’m setting them in a non-coding way.

Hi @contact18013
There was an issue on Wix side and it should be fixed now for your website. Sorry for the inconvenience.

Regards, Alex

Hello. Can you please send me the link to your site? Thanks

I’m glad i could help.

as Aleksander just said, seems there whas an issue with show/hide on the Wix side, so if you want you can change it back to show/hide instead of expand/collapse

Kind regards,
Kristof.