Hide and Show element on mobile

I need your help. I managed to hide one element on some pages of my desktop but it doesn’t work on the mobile version. I use the following code:

import wixWindow from ‘wix-window’;

if (wixWindow.formFactor === “Desktop” &&

wixWindow.rendering.renderCycle === 1) {

 $w("#element1").hide(); 

$w.onReady( function () {

if (wixWindow.formFactor === “Mobile” &&

wixWindow.rendering.renderCycle === 1) {

 $w("#Element1").show(); 

Thanks for your help.

With the rendering it is only env that is still working, renderCycle and warmUpData are no longer used.
https://www.wix.com/corvid/reference/wix-window.rendering.html
https://www.wix.com/corvid/forum/corvid-tips-and-updates/rendercycle-and-warmupdata-are-now-deprecated
https://support.wix.com/en/article/corvid-about-the-page-rendering-process

See here for working with mobile only code.
https://www.wix.com/corvid/reference/wix-window.html#formFactor
https://support.wix.com/en/article/corvid-tutorial-displaying-elements-in-mobile-only
https://support.wix.com/en/article/corvid-writing-code-that-only-runs-on-mobile-devices