Live site- http://www.uposonghar.com/test/test_popup.html
I add JavaScript cookie with that popup so if anyone click on "Click Here if don't want to see this Again!" button then cookie will be stored, if cookie is stored then popup will not appear for him/her.
Once i click on that button cookie stored successfully, popup(id-myModal) disappear but popup bg/overlay(id- reveal-modal-bg) appears. i add that code but that doesn't work-
if(getCookie('abc')=="def" && document.getElementById('myModal'))
document.getElementById('myModal').style.display="none";
document.getElementById('reveal-modal-bg').style.display="none";
There is a css on js page, maybe that overwrite my display:none as display:block- http://www.uposonghar.com/test/jquery.reveal.js
Code of js page-
if(options.animation == "none") {
modal.css({'visibility' : 'visible', 'top':$(document).scrollTop()+topMeasure});
modalBG.css({"display":"block"});
unlockModal()
}
Full code-
<script type="text/javascript">
function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value + ";path=/";
}
function getCookie(c_name)
{
var c_value = document.cookie;
var c_start = c_value.indexOf(" " + c_name + "=");
if (c_start == -1)
{
c_start = c_value.indexOf(c_name + "=");
}
if (c_start == -1)
{
c_value = null;
}
else
{
c_start = c_value.indexOf("=", c_start) + 1;
var c_end = c_value.indexOf(";", c_start);
if (c_end == -1)
{
c_end = c_value.length;
}
c_value = unescape(c_value.substring(c_start,c_end));
}
return c_value;
}
if(getCookie('abc')=="def" && document.getElementById('myModal'))
document.getElementById('myModal').style.display="none";
document.getElementById('reveal-modal-bg').style.display="none";
</script>