如何始终显示Bootstrap 3模态? [英] How to always display Bootstrap 3 modal?
问题描述
Bootstrap 3模态默认为隐藏.要启动它们,我必须单击一个触发按钮:
Bootstrap 3 modals are hidden by default. To launch them I have to click a trigger button:
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>
我尝试了以下操作,但没有效果:
I have tried the following but it has no effect:
jQuery(window).load(function(){
jQuery('#myModal').modal('show');
});
如何确保我的模态始终显示在屏幕上?即我不希望用户通过单击触发按钮来手动显示它.我也不希望他们能够将其关闭.我希望它始终保持打开状态.
How can I ensure my modal is always displayed on screen? i.e. I don't want the user to have to manually display it by clicking on the trigger button. I don't want them to be able to close it either. I'd like it to remain open at all times.
推荐答案
这是更新的小提琴,用户无法关闭模型,但需要删除关闭按钮的html元素,这对用户来说是非常邪恶的:P
Here is the updated fiddle where users can't close the model but you need to remove the html elements for close buttons cuz thats very evil for your users :P
jQuery(window).load(function(){
jQuery('#myModal').modal('show').on('hide.bs.modal', function(e){
e.preventDefault();
});
});
这篇关于如何始终显示Bootstrap 3模态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!