I have a requirement that if a user is loggedin then he /she should not see the subscribe newsletter popup, which is a light box , elese the light box will appear . i have a light box called " subscribe newsletter" .
pleaase provide the code if any one have . I have tried many snippet none of them is working
Hello,
To accomplish this you can use the Wix-Members-Frontend API using loggedIn() to check whether the visitor is currently logged in or not.
Here’s a example of how you might accomplish this:
import { authentication } from 'wix-members-frontend';
$w.onReady(async () => {
const isLoggedIn = authentication.loggedIn();
if (isLoggedIn) {
// Handle condition when member is logged in
} else {
// Handle opening newsletter lightbox when visitor isn't logged in
}
});
Thanks for your help, I have such code with me but unable to hide or disable lightbox element . please help me provide a snipet to hide or disable lightbox.
regards
Suman
Assuming it is opening automatically, I would check the settings of the Lightbox to make sure it is not being opened automatically by a Lightbox Trigger.
You can then use openLightbox() from the Wix-Window-Frontend API to programmatically open the Lightbox in the right conditions.
1 Like