묻고답하기

안녕하세요. 선배님들.

제가 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 남기남
띵야 레이아웃을 적용 중일때 {$content} 부분만 빼 내는 방법 질문 [3] 2009.03.05 by 띵야
영구만세 기본 Content 위젯스킨에서 썸네일 뽑기 [3] file 2010.11.05 by 난다날아
정보미535 content 위젯에서 댓글추출시 new icon?? [1] 2011.06.15 by 송동우
엘로힘 아하브티 Content 이미지 슬라이더 위젯 쓰시는 분들 질문 좀할게요~ [1] 2011.08.28 by 송동우
고속열차 content 레벨아이콘 닉네임 문제 file  
qufekfgo10 도와주세여 ㅠㅠ 위젯수정하는데 갑자기 _getContent method is not exists 이오류가..ㅠ급해용 ㅠㅠ [3] file 2014.11.14 by 황비
티처킴 쌩초보의 허접한 질문... 외부페이지 연결 file  
boy2 jQuery 질문  
오뎅궁물 코어 1.8.3에서 변경된 CSS가 있나요? [5] 2015.11.18 by 오뎅궁물
thdwjdtjr 메뉴바를 길게하고자 합니다 [1] file 2015.11.25 by DoorWeb
오픈퀴어 스크롤 따라다니는 퀵메뉴 배너 [3] 2015.12.14 by 오픈퀴어
김쪼도사 jquery 페이어 팝업 10초 후 자동 닫기 [1] 2016.01.11 by 김쪼도사
김호띠 위젯 섬네일 링크  
파도. 스케치북 최근게시물 상단 탭 오른쪽 여백 없애기 file  
리치김 contentextended 사용자정의 출력 시, select type 은 array 이로 나옵니다.  
열라정수 [제발 부탁드려요]Content 위젯 기본 스킨(default) 게시물 제목이 잘리는 현상. [2] file 2017.07.25 by 열라정수
립샤 고수님들 제발 도와주세요. 창크기에 따라서 위젯 위치가 자꾸 변합니다 [1] 2018.10.15 by 르미