아래 질문을 드린 스크립트에 쿠키를 추가해 주고 싶습니다.
<script>
jQuery(document).ready(function($) {
var id = '#dialog';
//Get the screen height and width
var maskHeight = $(document).height();
var maskWidth = 1010;
//Set heigth and width to mask to fill up the whole screen
$('#mask').css('width', maskWidth);
$('#mask').css('height', maskHeight);
//transition effect
$('#mask').fadeIn(500);
$('#mask').fadeTo("slow",0.9);
//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();
//Set the popup window to center
$(id).css('top', winH/2-$(id).height()/2);
$(id).css('left', winW/2-$(id).width()/2);
//transition effect
$(id).fadeIn(2000);
//if close button is clicked
$('.window .close').click(function (e) {
//Cancel the link behavior
e.preventDefault();
$('#mask').hide();
$('.window').hide();
});
//if mask is clicked
$('#mask').click(function () {
$(this).hide();
$('.window').hide();
});
});
</script>
<div id="boxes">
<div id="dialog" class="window">
Your Content Goes Here
<div id="popupfoot"> <a href="#" class="agree">I agree</a> | <a class="close agree"style="color:red;" href="#">I do not agree</a> </div>
</div>
<div id="mask"></div>
</div>
#mask(배경) 을 클릭하거나 혹은 "i do not agree" 를 클릭해도 팝업이 닫히게 하면서 쿠키를 적용해서 1일 동안 같은 문서에 접속시 팝업이 안뜨게 하고 싶습니다.
물론 다른 문서에서 조건이 맞으면 팝업은 다시 떠야 하구요.
위 코드를 사용하시면 I agree 클릭시에만 쿠키에 저장합니다.
I do not agree 에도 쿠키 저장하시려면 해당 태그에 agree 클래스를 추가하시면 됩니다.