# Showing element on mobile only - not working

**URL:** <https://forum.wixstudio.com/t/showing-element-on-mobile-only-not-working/13959>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [November 20, 2018, 2:37am UTC](https://forum.wixstudio.com/t/showing-element-on-mobile-only-not-working/13959 "2018-11-20T02:37:55Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![charlotte36498](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@charlotte36498](https://forum.wixstudio.com/u/charlotte36498)\
**Post date:** [November 20, 2018, 2:37am UTC](https://forum.wixstudio.com/t/showing-element-on-mobile-only-not-working/13959/1 "2018-11-20T02:37:55Z")

</div>

Hoping to get some help - I have followed the instructions here [Build a Mobile Site with Code](https://support.wix.com/en/article/wix-code-tutorial-displaying-elements-in-mobile-only)  
and the element is still not showing on my mobile site. I have tried various options, from adding all element codes into the code, to just the main “repeater1” and nothing seems to work.

Any advise would be appreciated!

 ![](https://us1.discourse-cdn.com/wix/original/3X/2/6/2652b16efa09dfbf981851a278e09a9c8adbab9a.png)

---

<div class="post-metadata">

**Author:** ![stevendc](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/stevendc/32/669_2.png) [@stevendc](https://forum.wixstudio.com/u/stevendc)\
**Post date:** [November 20, 2018, 7:42am UTC](https://forum.wixstudio.com/t/showing-element-on-mobile-only-not-working/13959/2 "2018-11-20T07:42:06Z")

</div>

Hi Charlotte:

Here are a couple of thoughts but to be definitive you will need to share the URL of your site page.

Have you checked that the elements are not obscured by the repeater? Obviously if they aren’t then there is another issue.

To check for overlapping elements you need to enable the toolbar (see image below).

Sometimes the mobile settings for the page will try to optimize things by hiding elements automatically in mobile view. Have you checked that the elements are visible in mobile view?

Take a look at this article to see if it helps:

> **[Wix Editor: Fixing Layout Issues on Your Mobile Site | Help Center | Wix.com](https://support.wix.com/en/article/wix-editor-fixing-layout-issues-on-your-mobile-site)**
>
> Wix automatically creates a mobile-friendly site for you using the content and elements from your desktop site. They are not different sites, just different vie

As I said above if these don’t help then if you can share the url it will help the community trace the problem.

Steve

---

<div class="post-metadata">

**Author:** ![stevendc](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/stevendc/32/669_2.png) [@stevendc](https://forum.wixstudio.com/u/stevendc)\
**Post date:** [November 20, 2018, 7:42am UTC](https://forum.wixstudio.com/t/showing-element-on-mobile-only-not-working/13959/3 "2018-11-20T07:42:33Z")

</div>

![](https://us1.discourse-cdn.com/wix/original/3X/e/d/ede397fd91b9fefdbcfff5fa2c08fca104f16e0f.jpeg)

---

<div class="post-metadata">

**Author:** ![charlotte36498](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@charlotte36498](https://forum.wixstudio.com/u/charlotte36498)\
**Post date:** [November 20, 2018, 8:07am UTC](https://forum.wixstudio.com/t/showing-element-on-mobile-only-not-working/13959/4 "2018-11-20T08:07:32Z")

</div>

Hi Steve - thank you so much. I can see there are overlapping elements, however not sure what i’m meant to do now? the URL is [lottesocial.com](http://lottesocial.com) and I have attached images of what i can see in layers and overlapping items, however nothing is hidden

 ![](https://us1.discourse-cdn.com/wix/original/3X/6/2/6284d784e283622ead9b20ca9a358381ffea3569.jpeg)

---

<div class="post-metadata">

**Author:** ![stevendc](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/stevendc/32/669_2.png) [@stevendc](https://forum.wixstudio.com/u/stevendc)\
**Post date:** [November 20, 2018, 10:57am UTC](https://forum.wixstudio.com/t/showing-element-on-mobile-only-not-working/13959/5 "2018-11-20T10:57:18Z")

</div>

Hi Charlotte:

OK Your primary problem is that you have the repeater both hidden AND collapsed. To show the repeater you need to show() AND expand() the repeater.

 ![](https://us1.discourse-cdn.com/wix/original/3X/6/2/625a410dfee009973a641c941b37d88e2d8c1deb.png)

Also since the container, and text elements are a part of the repeater you don’t need to do anything with these elements. The container is correctly inside of the repeater (on top of it) and so when the repeater is hidden it will also be hidden and when the repeater is shown, it too will be shown. Just make sure that $w(‘#container1’), $w(‘#text15’), $w(‘#text16’) are not hidden and not collapsed on load.

Your code should then look like this:

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

$w.onReady(() => {
    if (wixWindow.formFactor === "Mobile") {
        $w('#repeater1').show();
    }
});

```

Hope this does the trick!

Steve

---

<div class="post-metadata">

**Author:** ![charlotte36498](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@charlotte36498](https://forum.wixstudio.com/u/charlotte36498)\
**Post date:** [November 20, 2018, 11:04am UTC](https://forum.wixstudio.com/t/showing-element-on-mobile-only-not-working/13959/6 "2018-11-20T11:04:38Z")

</div>

Thanks Steve - I had tried that, but then on my desktop site, I have a massive white gap where the repeater is hidden… any idea how to remove this?

---

<div class="post-metadata">

**Author:** ![doron-alkalay](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/doron-alkalay/32/2887_2.png) [@doron-alkalay](https://forum.wixstudio.com/u/doron-alkalay)\
**Post date:** [November 20, 2018, 11:35am UTC](https://forum.wixstudio.com/t/showing-element-on-mobile-only-not-working/13959/7 "2018-11-20T11:35:01Z")

</div>

Hi @charlotte36498 !

[This](https://support.wix.com/en/article/wix-code-how-page-layout-is-affected-when-elements-change-size) article might be helpful in this case.

Doron.

---

<div class="post-metadata">

**Author:** ![stevendc](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/stevendc/32/669_2.png) [@stevendc](https://forum.wixstudio.com/u/stevendc)\
**Post date:** [November 20, 2018, 12:53pm UTC](https://forum.wixstudio.com/t/showing-element-on-mobile-only-not-working/13959/8 "2018-11-20T12:53:08Z")

</div>

@charlotte36498 Yes so what you really need to do is not use the hidden capability you need to use the collapse and expand capability. They both have similar effects the difference being that collapse() essentially removes the white space that would be occupied by a hidden element, expand() essentially expands to show the content in the element.

So you need to un-click **“Hidden on load”** check box in the repeater Properties and check **“Collapsed on load”.**

Then your code should look like this:

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

$w.onReady(() => {
    if (wixWindow.formFactor === "Mobile") { 
        $w('#repeater1').expand();
    }
});

```

Here are the document references:

- Show & Hide

- Collapse & Expand

Cheers

---

<div class="post-metadata">

**Author:** ![charlotte36498](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@charlotte36498](https://forum.wixstudio.com/u/charlotte36498)\
**Post date:** [November 21, 2018, 4:08am UTC](https://forum.wixstudio.com/t/showing-element-on-mobile-only-not-working/13959/9 "2018-11-21T04:08:27Z")

</div>

@stevendc Amazing - thank you so much! that worked 🙂 🙂
