묻고답하기

안녕하세요. 선배님들.

제가 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 남기남
파도. 스케치북 최근게시물 상단 탭 오른쪽 여백 없애기 file  
haupt [질문] CK Editor 에서 앞에 행번호 가 안붙습니다.  
haupt [질문] DWbasic skin 소스 변경할수있을까요?  
다함께 DB Table 생성을 해야 설치가 완료됩니다. file  
deom 안드로이드 폰에서 background-attachment: fixed; [2] 2017.01.20 by deom
lark007 XEDITION 레이아웃에 하단 메뉴 부분에 메뉴를 안쓰고 일반 사이트 하단처럼 사이트정보로 쓸수 없나요? [4] file 2017.01.19 by lark007
쿠닌 admin 페이지 메뉴 오류 [2] file 2017.01.12 by 쿠닌
비제이티비 /modules/document/document.item.php 967줄 에러 file  
James 009 XE mySQL에서 [1] 2016.12.20 by 제이와이엔소프트
dfasdfasdf 사이드 스크롤배너 이미지와 링크 변경 및 삭제 방법 아시는 분 있으신가요? file  
웃음을주는사람 video 태그 질문입니다.  
Roy domain.com/index.php 에서만 접속가능 [2] 2016.11.09 by 불금
Megg wrap으로 감싼 부분이 height 100퍼센트가 원래 안되나요...? [4] file 2016.11.03 by SimpleCode
ljk**** 외부페이지에서 Ajax로 등록처리시 &DB 가 존재하지 않아요  
영흥도우럭1 실시간 새글 알림 애드온..질문드립니다. file  
쿠닌 어드민 페이지 메뉴 [2] file 2016.10.13 by 쿠닌
너굴 업데이트 했더니.. 에러가 나고 아무것도 안떠요...ㅠㅠ 도와주세요..ㅠ [5] 2016.10.13 by 김전설
청*솔 iframe 으로 붙혀넣기 했는데.! [2] file 2016.09.12 by 청*솔
outsider CKEditor에 extraPlugins 설치 후 툴바가 나타나지 않는 현상? [3] file 2016.08.03 by outsider
outsider 이미지 갤러리 컴포넌트 loading 문제 file