I am new to jQuery, and I have some needs on my website. I want to show the jQuery div popup at the first time only when the user comes. No need to show again and again.
You can set a cookie to store a value and check if it is not set then show popup:
$(document).ready(function() {
var isshow = $.cookie("isshow");
if (isshow == null) {
$.cookie("isshow", 1); // Store
// Show popup here
$('#jPopup').show();
}
});
Or you can set localStorage. Here is a working example. jsFiddle
$(document).ready(function() {
if(localStorage.getItem('popState') != 'shown') {
$("#popup").delay(2000).fadeIn();
localStorage.setItem('popState','shown')
}
});