2013-11-03 3 views
2

내 홈페이지에 환영 팝업이 있습니다. 자바 스크립트에서 지연 시간 설정

내가 가진이 자바 스크립트 내가 3 초 지연을 설정하는 방법

<script type="text/javascript"> 
    $(document).ready(function() { 
     $("#div-welcome").dialog({ 
       width: 'auto', 
       height: 'auto', 
       modal: true 
     }); 
    }); 
</script> 

? setTime 함수로 시도했지만 작동하지 않습니다. 어쩌면 나는 그것을 잘못된 장소에 넣었을 것이다. 감사합니다. Aversa의

+0

비슷한 질문, http://stackoverflow.com/questions/17305879/load-jquery-modal-dialog-after-a-delay –

답변

0
$(document).ready(function() { 
    window.setTimeout(function() { 
     $("#div-welcome").dialog({ 
       width: 'auto', 
       height: 'auto', 
       modal: true 
     }); 
    }, 3000); 
}); 
+0

덕분에 많이! 좋은 하루 되세요! – AVersa

+0

Np! :) 그런데, 만족 스럽다면 답을 받아주십시오. –

1

사용 setTimeout.

setTimeout() 메서드는 지정된 밀리 초 후에 함수를 호출하거나 식을 계산합니다.

쓰기이 :

$(document).ready(function() { 
    setTimeout(function(){ 
     $("#div-welcome").dialog({ 
      width: 'auto', 
      height: 'auto', 
      modal: true 
     }); 
    },3000); 
}); 
관련 문제