我能够在页面加载时加载一个bootstrap模式,只是想知道如何在页面加载后加载模态X秒?到目前为止,这是我的代码。
<script type="text/javascript">
$(window).load(function(){
$('#myModal').modal('show');
});
</script>
答案 0 :(得分:1)
setTimeout(function,delayInMiliSeconds)
<script type="text/javascript">
$(window).load(function(){
setTimeout(function(){$('#myModal').modal('show');},3000); \\Executes after 3 seconds
});
</script>
Jquery的:
<script type="text/javascript">
$(window).load(function(){
$('#myModal').delay(3000).modal('show'); \\same as above
});
</script>