Hide a line on the main website

Hello all!

I am looking to hide a line on the computer based website but shows when in a mobile format. How would I go about doing this?

Thanks in advanced

Hi Primalconquest,
Check out this reference .

if (formFactor === "Mobile" ) {
    $w('yourLineElement').hide()
}

Good luck!

Thank you Roi. :slight_smile:

Roi am I to type in the code as you have put it there as it does not seem to work or have I got to aulter the top line of code as well? I want the line to only show on mobile.

Thanks again.

Hi,

import wixWindow from 'wix-window';

$w.onReady(() => {
let formFactor = wixWindow.formFactor;
if (formFactor === "Desktop") {
 $w('yourLineElement').hide()
}
if (formFactor === "Mobile") {
 $w('yourLineElement').show()
  }
})

Try this,
Good luck!

Hi Roi


Is this right I have just changed enterd the line eliment name as there is still error marks?

import wixWindow from ‘wix-window’;

$w.onReady(() => {
let formFactor = wixWindow.formFactor;
if (formFactor === “Desktop”) {
$w(‘line22’).hide()
}
if (formFactor === “Mobile”) {
$w(‘line22’).show()
}
})

Change this $w(‘line22’) to $w(‘#line22’)