채택완료

24시간 뒤에 팝업창 띄우려면 어떻게 해야 하나요 ?

2019-02-28 (목) 16:44:49 3,914

팝업창 관련 소스인데 24시간 뒤에 뜨게 하는 예약시간을 걸고 싶은데 어떻게 해야 할지 막막하네요 /..ㅠ 
고수 분들의 도움이 필요합니다 ㅠ!!

Copy
<script type="text/javascript">
    <!--
    /*쿠키삭제*/
    function delPopupCookie(id){
        var nowcookie = getPopupCookie('popview');
        setPopupCookie('popview', '['+id+']' + nowcookie , 0);
    }
    /*쿠키세팅*/
    function setPopupCookie(name,value,expiredays) { 
        var todayDate = new Date(); 
        todayDate.setDate( todayDate.getDate() + expiredays ); 
        document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
    }
    /*쿠키추출*/
    function getPopupCookie( name ){
        var nameOfCookie = name + "=";
        var x = 0;
        while ( x <= document.cookie.length ){
            var y = (x+nameOfCookie.length);
            if ( document.cookie.substring( x, y ) == nameOfCookie ) {
                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 getElm(id){
        return document.getElementById(id);
    }
    /*닫기동작*/
    function hideLayerPopup(uid) { 
        if (getElm('pop-layer-'+uid+'-ckd').checked == true){
            var nowcookie = getPopupCookie('popview');
            setPopupCookie('popview', '['+uid+']' + nowcookie , 1);
        }    
        getElm('pop-layer-'+uid).style.display = 'none';
    }
    /*숨기기체크*/
    if (getPopupCookie('popview').indexOf('[<?=$popupNum?>]') == -1){
        getElm('pop-layer-<?=$popupNum?>').style.display = 'block';
    }
    /*숨겨진 팝업 쿠키를 초기화 할때 사용 - 스크립트가 아래 존재하기에 새로고침을 두번 해야 적용됨*/
    //delPopupCookie('<?=$popupNum?>');
    //-->
    </script>

답변 2개

채택된 답변
+20 포인트

팝업을 띄우는 부분의 소스는 없는것 같습니다.

참고만 해 보세요..

<script>
function popup_timer() {
setTimeout(function() {
$('#ID명 변경').css('display','block'); // 출력할 div
}, 24*60*60);
}

$(function() {

popup_timer();
});
</script>

답변을 작성하려면 로그인이 필요합니다.