Pro gallery hide/show issues

Hi all,

Currently editing for desktop and mobile. I’ve got a design for desktop, which when it comes to mobile, I need to use the hide/show coding so its practical when viewing on different platforms.

Currently, in Wix editor, its viewed fine. However, when it comes to viewing the live site, I suddenly get a huge gap between two elements (please see attached).

Why would this be? Is it my coding?

import wixWindow from ‘wix-window’ ;

$w.onReady( function () {
if (wixWindow.formFactor === “Mobile” ){
$w( “#mobilegallery” ).show();
$w( “#desktopgallery” ).hide();

How it looks on editor

How it looks once viewed as ‘live site’