我正在这样做,它在桌面上运行良好:
$(document).on("click", function(){
$(".dropdown-toggle").removeClass("open");
});
但在 iPad 上它不起作用,我的下拉菜单仍然打开
最佳答案
您应该对触摸设备使用 touchstart
和 touchend
事件:
$(document).on("click touchend", function(){
$(".dropdown-toggle").removeClass("open");
});
关于javascript - 当我们在平板电脑上点击外部时如何关闭 bootstrap 3 下拉菜单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28217706/