묻고답하기

안녕하세요. 선배님들.

제가 xpress 게시판에 아래와 같은 스크립트를 사용해 modal layer 팝업을 사용하고 있습니다.

페이지가 로드될 때 자동으로 뜨게 되어 있는데, 여기에 10초 후 자동으로 닫게 하는 방법을 알고 싶습니다.

"setTimeout()"를 활용해서 닫기가 가능한 것 같은데, 제가 코드엔 문외한이라 너무 어렵네요.

선배님들의 고견 부탁 드립니다. 제발요오~

 

--- 현재 사용하고 있는 코드

        <style>
            * {
                margin:0; 
                padding:0;
            }

            #overlay {
                position:fixed; 
                top:0;
                left:0;
                width:100%;
                height:100%;
                background:#000;
                opacity:0.8;
                filter:alpha(opacity=20);
            }

            #modal {
                position:absolute;
                background:rgba(0,0,0,0.2);
                border-radius:14px;
                padding:0px;
            }

            #content {
                border-radius:8px;
                background:#fff;
                padding:10px;
            }

            #close {
                position:absolute;
                background:url(../layer/close_.png) 0 0 no-repeat;
                width:1px;
                height:1px;
                display:block;
                text-indent:-9999px;
                top:-7px;
                right:-7px;
            }
        </style>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script>        
            var modal = (function(){
                var 
                method = {},
                $overlay,
                $modal,
                $content,
                $close;
                                
                // Center the modal in the viewport
                method.center = function () {
                    var top, left;

                    top = Math.max($(window).height() - $modal.outerHeight(), 0) / 2;
                    left = Math.max($(window).width() - $modal.outerWidth(), 0) / 2;

                    $modal.css({
                        top:top + $(window).scrollTop(), 
                        left:left + $(window).scrollLeft()
                    });
                };

                // Open the modal
                method.open = function (settings) {
                    $content.empty().append(settings.content);

                    $modal.css({
                        width: settings.width || 'auto', 
                        height: settings.height || 'auto'
                    });

                    method.center();
                    $(window).bind('resize.modal', method.center);
                    $modal.show();
                    $overlay.show();
                };

                // Close the modal
                method.close = function () {
                    $modal.hide();
                    $overlay.hide();
                    $content.empty();
                    $(window).unbind('resize.modal');                    
                };

                // Generate the HTML and add it to the document
                $overlay = $('<div id="overlay"></div>');
                $modal = $('<div id="modal"></div>');
                $content = $('<div id="content"></div>');
                $close = $('<a id="close" href="#">close</a>');

                $modal.hide();
                $overlay.hide();
                $modal.append($content, $close);

                $(document).ready(function(){
                    $('body').append($overlay, $modal);                        
                });
                
                $close.click(function(e){
                    e.preventDefault();
                    method.close();
                });

                return method;
            }());

            // Wait until the DOM has loaded before querying the document
            $(document).ready(function(){

                $.get('../layer/ajax.html', function(data){
                    modal.open({content: data});
                });

            });
        </script>

태그 연관 글
  1. [2016/12/21] 묻고답하기 고수님들 제발 도와주세요. 창크기에 따라서 위젯 위치가 자꾸 변합니다 by 립샤 *1
  2. [2015/12/14] 묻고답하기 스크롤 따라다니는 퀵메뉴 배너 by 오픈퀴어 *3
  3. [2015/11/24] 묻고답하기 메뉴바를 길게하고자 합니다 by thdwjdtjr *1
  4. [2015/07/16] 묻고답하기 jQuery 질문 by boy2
  5. [2015/05/23] 묻고답하기 쌩초보의 허접한 질문... 외부페이지 연결 by 티처킴
글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
뉴질맨 1.8.13 to 1.8.15 Version UP [2] 2015.12.15 by 뉴질맨
세상의모든계산기 ckeditor 에서 SHIFT+ENTER 로 줄바꿈(BR)시 한글 깨짐 현상  
김쪼도사 jquery 페이어 팝업 10초 후 자동 닫기 [1] 2016.01.11 by 김쪼도사
hyotory 메뉴 #지정한 구간으로 이동문의 [2] 2016.02.01 by rwind
NateKwon 사이드바에 옵트인 삽입하는데 문제가 있습니다.  
lark007 contact board 서브 페이지에서 작동이 안되네요ㅠ 도와주세요~ㅠㅠ  
Hi_Roy 아래 코드가 IE8에선 동작하는데 크롬/파폭/IE11 에선 오동작을 하네요. 무엇이 문제일까요? ㅡ_ㅡ; [1] 2016.02.25 by 기진곰
tohappy 외부페이지에서 Google Map jquery 에러 해결방법 문의 [2] 2016.03.03 by tohappy
기무태루 대시보드 레이아웃 깨짐 [1] file 2016.03.07 by XE카오스
뉴질맨 Core Up 1.8.15 - 1.8.18 [2] 2016.03.11 by 뉴질맨
뻬빠 WORD문서 내용 복사해서 붙이기 문의 [1] 2016.03.14 by 뻬빠
Hi_Roy Edge 브라우저에서 제 게시판 툴바 중에 특수문자랑 미디어 삽입이 동작하지 않는데 해결방법을 모르겠네요. [1] 2016.03.21 by 퍼니엑스이
theaud**** 폴더안 txt 문서를 php explode 하여 mysql 에 넣는 과정이 안됩니다ㅠㅠ  
마뇨 앱을 통한 직접 입력 후 웹 게시판에서 수정할려고 합니다.  
물김밥 LNB메뉴 사이즈 조절 할 수 없을까요..? [1] 2016.03.29 by WebdesignerS
디버 XE + CUBRID 문의 [1] 2016.03.29 by 기진곰
으흥 XE mysqli_innodb 설치 진행 안되는 문제, sock 방식 연결 [3] file 2016.04.09 by 으흥
캣대디 실시간 새글 알림 애드온 특정게시판만 알림오게하려고 합니다. [5] 2016.04.18 by 꽃민
꽃민 관리자만 알림 뜨려면... [2] 2016.04.19 by 꽃민
꽃민 새글 알림 도와주세요..ㅠㅠ [2] 2016.04.19 by 꽃민