【发布时间】:2015-03-13 10:44:05
【问题描述】:
我有一个点击空格键的计划。它确实发生了。
// when space bar is pressed
do-something; // Applied on the $(document).keypress..
但是,当我按下空格键以及必须触发的事件/动作时,模态加载/再次出现。为什么会这样?我试图阻止模态再次加载:
$('#goal').on('hidden.bs.modal',function() {
$(document).focus(); // Get the button that triggered modal
// out of focus
});
但是文档没有获得焦点,并且触发模态加载的按钮保持焦点,直到我单击屏幕使文档恢复焦点。如何防止模态在空格键上再次加载?
我还尝试了触发模式的按钮上的blur() 功能。但它没有帮助吗?
【问题讨论】:
标签: javascript jquery html twitter-bootstrap modal-dialog