Prindol

DESIGN, HTML5, CSS3, DOM, Jquery, JSON, Actionscript2/3, Linux, IIS

You are not logged in.

#1 2012-08-16 15:15:50

skydown
Administrator
Registered: 2011-07-25
Posts: 315

[JAVASCIPT] 팝업, popup, 오늘 하루 열지 않음, 리사이즈

            <div id="popupWrap" class="popup-wrap popup-familymart">
                <div class="popup-inner">
                    <p><img src="http://image.career.co.kr/albaro/popup/family_mart_120816/popup_family_mart.gif" alt="" /></p>
                    <form  class="today" id="checkForm" name="checkForm">
                        <label onclick="closeWin();">
                            <input id="chkbox" name="chkbox" type="checkbox" />
                            <span>오늘 하루 열지 않음</span>
                        </label>
                    </form>
                    <iframe frameborder="0" class="iframe" title="익스6 셀렉트가림"></iframe>
                </div>
            </div>

            <script language="Javascript">
            <!--
            function setCookie( name, value, expiredays ) { 
                var todayDate = new Date(); 
                todayDate.setDate( todayDate.getDate() + expiredays ); 
                document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
            }

            function closeWin() { 
                if ( document.getElementById('checkForm').chkbox.checked ){ 
                    setCookie( "popupdiv", "done" , 1 ); 
                } 
                document.all['popupWrap'].style.display = "none";
            }

            cookiedata = document.cookie;    
            if ( cookiedata.indexOf("popupdiv=done") < 0 ){      
                document.all['popupWrap'].style.display = "block";
            } else {
                document.all['popupWrap'].style.display = "none"; 
            }
            //-->  
            </script>

Offline

#2 2013-04-09 18:15:24

skydown
Administrator
Registered: 2011-07-25
Posts: 315

Re: [JAVASCIPT] 팝업, popup, 오늘 하루 열지 않음, 리사이즈

- 팝업창 띄우기, popup open
- 레이어 팝업 띄우기 모션, layer popup
- 오늘 하루 열지 않기 기능 (쿠키)

/* 팝업 스크립트 */
function getCookie(name) {
    var Found = false;
    var start, end;
    var i = 0;
    while(i <= document.cookie.length) {
        start = i;
        end = start + name.length;
        if(document.cookie.substring(start, end) == name) {
            Found = true;
            break;
        }
        i++;
    }
    if(Found == true) {
        start = end + 1;
        end = document.cookie.indexOf(";", start);
        if(end < start)
            end = document.cookie.length;
        return document.cookie.substring(start, end);
    }
    return "";
}
function setCookie( name, value, expiredays ){
    var todayDate = new Date();
    var m = (23 - todayDate.getHours()) * 60;
    var s = (m + (59 - todayDate.getMinutes())) * 60;
    var ms = (s + (59 - todayDate.getSeconds())) * 1000;
    var expireTime = todayDate.getTime() +  ms;
    todayDate.setTime(expireTime);
    document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + "; domain=career.co.kr;"
}
function closeWin(cookiename){
    setCookie(cookiename, "no" , 1); // 1일 간 쿠키적용
}
function srcUrl(src1) {
    opener.document.location.href = src1;
    window.close();
}
function openMsgBox(page,cookiename,width,height){
    var eventCookie = getCookie(cookiename);
    if (eventCookie != "no")
    window.open(page, cookiename, 'toolbar=no,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0,copyhistory=0, width='+width+', height='+height+',top=0,left=0');
}
function layerPopup() {//레이어팝업
    var eventCookie = getCookie('layerPopup');
    var _layer = document.getElementById('layerPopup');
    var _inner = $(_layer).find('> .layerInner');
    if (eventCookie != "no") {
        $(_layer).css({'display':'block','height':'0'}).animate({
            height:'auto'
        },600,function() {
            $(_inner).css({'display':'block','marginTop':'100px'}).animate({
                marginTop:0
            },150);
        });
        $(_layer).find('> .layerInner .close').click(function() {
            hideLayer();
        });
        $(_layer).find('> .layerInner .closetoday').click(function() {
            closeWin('layerPopup');
            hideLayer();
        });
    }
    function hideLayer() {
        $(_inner).animate({
            marginTop:100
        },150,function() {
            $(_layer).css('display','none');
        });
    }
}
/* //팝업 스크립트 */

Offline

#3 2014-02-21 14:29:59

skydown
Administrator
Registered: 2011-07-25
Posts: 315

Re: [JAVASCIPT] 팝업, popup, 오늘 하루 열지 않음, 리사이즈

팝업 리사이즈

<script>
    
$Fn(function(e) {
        resizePopup(520, 270);
}).attach(window, 'load');  

function resizePopup(w, h) {
        document.body.style.overflow = 'hidden';
        var clintAgent = navigator.userAgent;
        if(clintAgent.indexOf("MSIE") != -1){
                window.resizeBy(w - document.body.clientWidth, h - document.body.clientHeight);
        }else{
                window.resizeBy(w - window.innerWidth, h - window.innerHeight);
        }
        $Window().sizeToContent();
}
</script>

Offline

Board footer

Powered by FluxBB