# How to hide and collapse  item on desktop view but show it on mobile view

**URL:** <https://forum.wixstudio.com/t/how-to-hide-and-collapse-item-on-desktop-view-but-show-it-on-mobile-view/9615>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [September 9, 2021, 8:35pm UTC](https://forum.wixstudio.com/t/how-to-hide-and-collapse-item-on-desktop-view-but-show-it-on-mobile-view/9615 "2021-09-09T20:35:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![csikaszk](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@csikaszk](https://forum.wixstudio.com/u/csikaszk)\
**Post date:** [September 9, 2021, 8:35pm UTC](https://forum.wixstudio.com/t/how-to-hide-and-collapse-item-on-desktop-view-but-show-it-on-mobile-view/9615/1 "2021-09-09T20:35:50Z")

</div>

I am a novice, and thanks heaps for your reply and advice

I have used the below code and it did the hide on desktop and showed it on mobile, but on the desktop it showed the blank space (page) which was behind the hidden item. I have tried clicking the “hide” and “collapse” buttons, but made no difference, i am also getting 2 error messages when in preview.

Code used

import wixWindow from ‘wix-window’ ; $w . onReady (()=\>{ let formFactor = wixWindow . formFactor ; console . log ( formFactor ); if ( formFactor === “Mobile” ) { $w ( “#slideshow2” ). show ();} **else** { $w ( “#slideshow2” ). hide ();}}); I have tried option  
**else** { $w ( “#slideshow2” ).collapse();}

2 error messages:

- Loading the code for the Home page. To debug this code, open mainPage.js in Developer Tools.  
Desktop line 4

when i click on line 4 it takes me back to the code and it puts the blinking courser between console and the full stop

- Improve loading time by turning on caching for the Home page. [Lear](https://support.wix.com/en/article/caching-your-sites-pages) n more

* * *

i have also tried a different code with checking the hide and collapse checkboxes

import wixWindow from ‘wix-window’;  
$w.onReady(function () {  
if(wixWindow.formFactor === “Mobile”){  
$w(“#slideshhow2”).expand();  
}  
});

with this code i only get the below error and it still does not collapse the space behind the hidden item

- Loading the code for the Home page. To debug this code, open mainPage.js in Developer Tools.

thanks heaps in advance

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [September 9, 2021, 8:50pm UTC](https://forum.wixstudio.com/t/how-to-hide-and-collapse-item-on-desktop-view-but-show-it-on-mobile-view/9615/2 "2021-09-09T20:50:34Z")

</div>

I was almost sure, that i already have answered to a very very similar post.  
Where is the collapse-command in your code?

```javascript
import wixWindow from'wix-window';

$w.onReady(()=>{console.log("Page is ready!!!")
    let formFactor = wixWindow.formFactor; console.log(formFactor);
    //first you have to expand then to show the element......
    if(formFactor==="Mobile") {$w("#slideshow2").expand(); $w("#slideshow2").show('fade');}
    // here --> first hide and than collapse....
    else{$w("#slideshow2").hide(); $w("#slideshow2").collapse();}
});

```

Please also use code-blocks next time to show your code in a nice format, with a good readability.

If you get errors while running your code —\> than your code will stop and will not continue until end.  
Therefore you have to navigate to the CONSOLE —\> where you can inspect what is happening at the issued checkpoint.

You can for example open the CONSOLE in google-chrome, by a click onto F-12 and than navigating to → CONSOLE.

Or you can use the Wix-Editor, where you will find the CONSOLE on the very bottom of your Editor.

Also if someone would now say —\> this is not a promise and you don’t have to use async-await —\> just do it and you will see the difference.

```javascript
import wixWindow from'wix-window';

$w.onReady(async()=>{console.log("Page is ready!!!")
    let formFactor = wixWindow.formFactor; console.log(formFactor);
    //first you have to expand then to show the element......
    if(formFactor==="Mobile") {$w("#slideshow2").expand(); $w("#slideshow2").show('fade');}
    // here --> first hide and than collapse....
    else{await $w("#slideshow2").hide('fade'); $w("#slideshow2").collapse();}
});

```

* * *

Found your original post…

> **[How do I hide a strip on desktop but show on mobile? | Velo by Wix](https://community.wix.com/velo/forum/coding-with-velo/how-do-i-hide-a-strip-on-desktop-but-show-on-mobile)**
>
> I want hide the strip on desktop with all elements inside the strip. I want the same strip(and elements) to remain visible on mobile.

---

<div class="post-metadata">

**Author:** ![csikaszk](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@csikaszk](https://forum.wixstudio.com/u/csikaszk)\
**Post date:** [September 9, 2021, 10:05pm UTC](https://forum.wixstudio.com/t/how-to-hide-and-collapse-item-on-desktop-view-but-show-it-on-mobile-view/9615/3 "2021-09-09T22:05:06Z")

</div>

@russian-dima thanks fro your answer. it still does not work. how much woudl you charge to have a look at it online, if i hire you? and how can i hire you?

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [September 10, 2021, 6:31am UTC](https://forum.wixstudio.com/t/how-to-hide-and-collapse-item-on-desktop-view-but-show-it-on-mobile-view/9615/4 "2021-09-10T06:31:01Z")

</div>

You can find my email in my profile.

---

<div class="post-metadata">

**Author:** ![michaelbdrapper](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/michaelbdrapper/32/8508_2.png) [@michaelbdrapper](https://forum.wixstudio.com/u/michaelbdrapper)\
**Post date:** [October 2, 2022, 5:26pm UTC](https://forum.wixstudio.com/t/how-to-hide-and-collapse-item-on-desktop-view-but-show-it-on-mobile-view/9615/5 "2022-10-02T17:26:33Z")

</div>

The simplest answer is to drag the element over another element Right click hover over arrange and click on send to back on the desktop
