I want to make a lightbox appear on mouse hover, but when I close it, it should not appear again until the next visit. How to make this happen? I especially clueless about the part where it won't show for the second time.
top of page
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
bottom of page
The import code should be:
import {local} from 'wix-storage';
Notice the braces around "local". It's related to how JavaScript modules work, but we don't have to get into that. If you copied this example from our documentation, please let us know so we can fix it.
Another way to import (might be useful to more people) is to use code completion. Just press CTRL+SPACE at the beginning of the file, and you will see all the available imports.
The second problem is that you need to use the storage API:
https://www.wix.com/code/reference/wix-storage.Storage.html
Specifically, the setItem and getItem functions, in order to "save" and "retrieve" information from storage.
Look at the code examples there and let us know if you were able to make it work.
I have tried it, but it seems it doesn't work. Here is my code:
import local from 'wix-storage'; export function SUMMITHeader_mouseIn(event) { let formFactor = local.formFactor; $w("#MailingListPopUp").show("FadeIn"); } export function XMailingListPopUp_click(event) { $w("#MailingListPopUp").hide("FadeOut"); }
FYI I don't use lightbox, instead I just use a container box. The first one is the show effect. The second one is closing it with X button. Which part that I do wrong?
We provide 2 types of storage where you can store these kind of preferences.
One is for the current session, the other is until the user clears the browser's local storage.
You can read about it here:
https://www.wix.com/code/reference/wix-storage.html
Please take a look at the code examples and try to use it.
If you encounter any issues or errors, let us know and we'll guide you through it.
Current session only Tomer. But now I think the other one can be implemented too. So for "even if the user re-opens" then they have to cleared the cookies first?
Hi,
Do you want it not to appear again for the current session, or even if the user re-opens the site?