Answer the question
In order to leave comments, you need to log in
How to enable cookie js to show message 1 time?
There is a default window script open:
<div class="personal-data-warning" id="block_id">ОКНО<a class="black personal-data-warning-close" onclick="diplay_hide('#block_id');return false;" ></a></div>
function diplay_hide (blockId)
{
if ($(blockId).css('display') == 'none')
{
$(blockId).animate({height: 'show'}, 500);
}
else
{
$(blockId).animate({height: 'hide'}, 500);
}
}
Answer the question
In order to leave comments, you need to log in
Throw the key:value into the local storage and check this pair every time, if there is - do not show, if not - record and show
function diplay_hide (blockId)
{
if ($.cookie('isShowPopup')) return false;
if ($(blockId).css('display') == 'none')
{
$(blockId).animate({height: 'show'}, 500);
$.cookie('isShowPopup', '1');
}
else
{
$(blockId).animate({height: 'hide'}, 500);
}
}
Check for cookies before displaying. If they are not there, then install and show what you need there ...
if(!$.cookie('checker')) {
$.cookie('checker', 1, {
expires: 30
});
$(blockId).animate({height: 'show'}, 500);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question