workerLogger.js:53 Wix code SDK error: The current page is not a lightbox and therefore cannot be closed
Is it possible to programmatically close a lightbox? If so, how?
Page:
import wixWindow from 'wix-window';
$w.onReady(function () {
wixWindow.openLightbox('LightboxManual')
.then(() => console.log('closing'))
.catch((error) => console.log('error', error))
setTimeout(() => {
console.log('time to close lightbox')
//$w('#lightbox1').close()
wixWindow.lightbox.close()
// Wix code SDK error: The current page is not a lightbox and therefore cannot be closed
}, 5000)
})
Lightbox Settings:
It does not matter. I tried all combinations.
Hi,
No. because in that particular time the page that opens the lightbox stops the javascript flow. That is why
you need to close is from the lightbox it self.
Roi
Got it. The lightbox global variable on wixWindow could reference the current lightbox. I’ll add a feature request for something like $w('#myLightbox).close(…).