Bootstrap 3移动导航在您点击外部时会崩溃 [英] Bootstrap 3 Mobile nav won collapse when you click outside it
本文介绍了Bootstrap 3移动导航在您点击外部时会崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的Bootstrap 3移动菜单会崩溃。
My Bootstrap 3 mobile menu does collapse when I click/touch outside the menu.
我可以解决问题:
$(document).on('touchstart click', 'html:not(nav)',function() {
$(".navbar-collapse").removeClass("in");
});
然而,这不会像点击菜单按钮那样崩溃。请有人推荐更好的解决方案。
However this doesn't collapse the same way as if you were to click the menu button. Please can somebody recommend a better solution.
干杯
Al
Cheers Al
推荐答案
$(document).on('click',function(){
$('.navbar-collapse').collapse('hide');
})
这篇关于Bootstrap 3移动导航在您点击外部时会崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文