- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Bootstrap 4 模式来显示大型导航。要打开导航,我使用带有 CSS 动画的切换按钮。动画将汉堡菜单图标更改为 X。
问题是,如果您快速单击并且模态动画尚未准备就绪,按钮会变得困惑并显示 X,即使在已经关闭的菜单/模态中也是如此。
有什么方法可以在模式动画准备好之前禁用按钮吗?
这是我的代码:
$('.menu').click(function(){
$('#burger').toggleClass('active');
});
我看到,有一种方法可以收听模态动画:
$('#myModal').on('shown', function () {
// do something…
})
但我不知道如何在我的函数中实现它。
最佳答案
您可以将汉堡包的切换与显示/隐藏模态事件联系起来..
var toggleBurger = function () {
$('#burger').toggleClass('active-sandwich');
}
$('#nav-modal').on('show.bs.modal', toggleBurger)
$('#nav-modal').on('hide.bs.modal', toggleBurger)
关于javascript - Bootstrap 4 : Disable button until modal animation is done,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59019174/
我遇到过这个 html: 上面的html和这个有什么区别: 最佳答案 来自MDN page on the tag : 对于 type 的属性标签,可能的值是: 提交:按钮将表单数据提交给服务器
Button button= (Button) findViewbyID(R.id.button); 和 Button button = new Button(this); 有什么区别? 最佳答案 有
我是一名优秀的程序员,十分优秀!