창을로드하는 데 몇 초가 지난 후 약 5 초 후에 메시지 팝업으로 div를 만들 필요가 있습니다.몇 초 후에 자동으로 div 쇼를 만들고 싶습니다.
구글을 통해 몇 가지 자료를 찾고 있었는데이 site 에있는 훌륭한 예를 발견했습니다. 그러나이 소스에서 지원하지 않는 것은 시간을 설정할 수 있다는 것입니다. 코멘트에서 는 한 사용자가 시간 설정에 대한 의문을 제기하고, 제작자는이
VAR 쇼 =에서는 setTimeout 같은 ("팝업()", 3000)을 제안;
하지만 나에게는 적합하지 않습니다!
물론 같은 질문을했지만 지금은 답변을 얻지 못했습니다.
여기서는 제가 작업중인 page에 연결합니다. 미안해, 일본어 야! 몇 초 후에 표시하려고하는 빨간색 팝업 상자를 찾을 수 있습니다.
<script>
$(document).ready(function() {
// if user clicked on button, the overlay layer or the dialogbox, close the dialog
$('a.btn-ok, #dialog-overlay, #dialog-box').click(function() {
$('#dialog-overlay, #dialog-box').hide();
return false;
});
// if user resize the window, call the same function again
// to make sure the overlay fills the screen and dialogbox aligned to center
$(window).resize(function() {
//only do it if the dialog box is not hidden
if (!$('#dialog-box').is(':hidden')) popup();
});
});
//Popup dialog
function popup(message) {
// get the screen height and width
var maskHeight = $(document).height();
var maskWidth = $(window).width();
// calculate the values for center alignment
var dialogTop = (maskHeight/3) - ($('#dialog-box').height());
var dialogLeft = (maskWidth/2) - ($('#dialog-box').width()/2);
// assign values to the overlay and dialog box
$('#dialog-overlay').css({height:maskHeight, width:maskWidth}).show();
$('#dialog-box').css({top:dialogTop, left:dialogLeft}).show();
// display the message
$('#dialog-message').html(message);
}
</script>
<body<?php if(is_home()): ?> onload="popup('<p>「千葉県 行政書士」などの<br /> Yahoo! 検索で上位表示している、このウェブサイトを、<br /> あなたのものにしませんか?</p>')"<?php endif; ?>>
<div id="dialog-overlay"></div>
<div id="dialog-box">
<div class="dialog-content">
<div id="arrows"><img src="<?php bloginfo('template_url'); ?>/img/dilog-box_arrow.png" alt="" ></div>
<div id="dialog-message"></div>
<div class="al_c"><a href="<?php echo home_url(); ?>/sales/" target="_self"><img src="<?php bloginfo('template_url'); ?>/img/dialog-box_btn_off.png" class="btn" alt="HPレンタルの詳細ページへ" /></a></div>
<a href="#" class="button">閉じる</a>
</div>
</div>
</div>
일본에 대해 사과하지 마십시오! :-) –