묻고답하기

안녕하세요. 선배님들.

제가 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] 2016.01.30 by 불금
김쪼도사 jquery 페이어 팝업 10초 후 자동 닫기 [1] 2016.01.11 by 김쪼도사
김쪼도사 모바일 스킨에서 메뉴 호출이 안되는 문제  
김쪼도사 팝업 관리 애드온의 닫기 버튼 오류 file  
김쪼도사 페이지 로딩 시 자동으로 뜨는 modal layer 추가 방법 [4] file 2015.11.04 by 김쪼도사
김쪼도사 전체 쪽지 발송 시 메뉴 링크 자동 삽입 삭제 방법 문의 file  
김쪼도사 게시판 작성 중 페이지 이탈 시 경고 [2] file 2015.06.15 by 김쪼도사
김쪼도사 파도 접속자 위젯 사용 시 레벨 아이콘 표시 file  
김쪼도사 게시판 카테고리 박스 위치 조정 file  
김쪼도사 특정 게시물 백지 상태로 보이는 문제  
김쪼도사 특정 게시물 본문이 안보이는 문제 [4] 2014.04.02 by 김쪼도사
김쪼도사 게시물 본문이 보이지 않는 두가지 증상 [1] 2014.03.03 by 銀童
김쪼도사 등록된 사진이 본문에 표시되지 않습니다.  
김태학 게시판, 웹진형 보기의 문제점 [2] 2009.07.20 by 아치~
김태학 일부 게시물이 열리지 않습니다.  
김태학 업그레이드 후 문제점 문의 [2] file 2009.07.06 by 김태학
dcclim 아시는 분 부디 가르쳐 주세요.. [1] 2009.05.29 by 때린데 또때려