wixWindow.openLightbox() is not working

I’m trying to show a lightbox when people visit my website for the first time.

This is the code I have on my home page:

import {local} from 'wix-storage';
import wixWindow from 'wix-window';

$w.onReady(function () {
    if(!local.getItem("lightboxShown")) {
        ShowLightbox();
        local.setItem("lightboxShown", "Yes");
    }
});

function ShowLightbox() {
    wixWindow.openLightbox("MyLightbox");
}

When I load the page on the published website, nothing happens. The lightbox is not showing. Curiously, it works on mobile, but not on PC. I tried calling openLightbox() in my onReady(), but it doesn’t work either. I am calling the lightbox using its name, not its ID. I really don’t understand what I am doing wrong, especially since it works on mobile (at least on Android) and in the editor preview.

You forgot about the ending bracket ) in your code →

$w.onReady(function () {
    if(!local.getItem("lightboxShown")) {
        ShowLightbox();
        local.setItem("lightboxShown", "Yes");
    }
});  //here

I don’t know why it works in phone …
You should probably check here- >
https://www.wix.com/corvid/forum/community-discussion/rolling-out-improvements-to-corvid-sites-rendering

Thanks for your answer and well spotted, but unfortunately it’s just a copy-paste mistake I made while trying to format my post. I double checked but the ending bracket is there in my code, as well as the semicolon. Do you have any other idea of why it isn’t working?

You should probably post your issue here https://www.wix.com/corvid/forum/community-discussion/rolling-out-improvements-to-corvid-sites-rendering