I create auto popup in my website, but i have not show the auto popup again when user revisit my site?
My framwork is: Laravel 5.2
HTML:
<div id="popup_this">
<span class="button b-close">
<span>X</span>
</span>
<h3>A nice ad goes here!</h3>
<p>Nulla at nunc posuere, dictum sem sed, tristique mi.</p>
</div>
jQuery bPopup plugin:
<script src="/path/to/jquery.bpopup.min.js"></script>
Script:
<script>
$( document ).ready(function() {
$('#popup_this').bPopup();
});
</script>
I would recommend using JS Cookie to set the cookie once the user has seen the pop-up.
Also, you dont need a plugin to perform the pop-up. Just use Jquery and add a class then style everything in css.
I would do this with a simple localStorage.
You can read more about Storages in the browser here: Storage
$(document).ready(function() {
if(!localStorage.getItem('visited')){
localStorage.setItem('visited',true);
$('#popup_this').bPopup();}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.