오늘 하루 그만보기
by Kim Ara
HTML
<div id="main_popup" class="main_popup" style="position: absolute; z-index:10000; top:0px; left:0; display: none;">
<a href="" ><img src="" style="width:100%;height:400px;"/></a>
<div class="popup_bottom">
<a href="javascript:closePopupNotToday()" class="white">오늘하루 그만보기</a>
<a class="pull-right white" href="javascript:closeMainPopup();">닫기</a>
</div>
</div>
CSS
a{text-decoration:none; color:white}
.pull-right{float:right}
.main_popup{width:350px; height:430px; border:3px solid #3E4156;background-color: white;}
.popup_bottom{
background-color: #3E4156;
color: white;
height: 25px;
padding: 2px 10px 3px 10px;
width:330px;
}
JavaScript
if(getCookie("notToday")!="Y"){
$("#main_popup").show('fade');
}
function closePopupNotToday(){
setCookie('notToday','Y', 1);
$("#main_popup").hide('fade');
}
function setCookie(name, value, expiredays) {
var today = new Date();
today.setDate(today.getDate() + expiredays);
document.cookie = name + '=' + escape(value) + '; path=/; expires=' + today.toGMTString() + ';'
}
function getCookie(name)
{
var cName = name + "=";
var x = 0;
while ( x <= document.cookie.length )
{
var y = (x+cName.length);
if ( document.cookie.substring( x, y ) == cName )
{
if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
endOfCookie = document.cookie.length;
return unescape( document.cookie.substring( y, endOfCookie ) );
}
x = document.cookie.indexOf( " ", x ) + 1;
if ( x == 0 )
break;
}
return "";
}
function closeMainPopup(){
$("#main_popup").hide('fade');
}