Answer the question
In order to leave comments, you need to log in
Is there a plugin for sequentially displaying messages / notifications (cookies)?
For example, there are 5 different messages that need to be shown to users one by one (not all at once). If the user clicked the close button, this notification is no longer shown. On the next hit, the next message would be shown. Etc.
Please tell me, is there a similar plugin that would allow organizing this?
Answer the question
In order to leave comments, you need to log in
Your solution is written quite quickly, all you need to do is:
1. create an array of messages.
2. via setInterval (rather than setTimeout, because you don't need to display more than one message), you display the message by its serial number in the array.
3. if the person closed the message, write down the number of the closed message from the array (for example, 2) to the cookie.
4. at the beginning of the function, you just check for cookies. if there is, we output n+ 1 messages, if not, then 1 message.
That's basically your whole algorithm.
Here it is without plugins and libraries:
https://jsfiddle.net/MrStan1slav/9dfpzbcy/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question