内容简介:翻译自:https://stackoverflow.com/questions/29814709/click-event-not-fired-on-button-with-svg-element-in-safari
在Safari中,单击事件未在带有svg元素的按钮上触发.当你单击按钮边缘时单击事件会触发,但如果单击svg元素本身则不会.
$(document).on('click', 'button', function(e) {
console.log(e);
});
如果我附加这样的点击事件,它可以工作:
$('button').on('click', function(e) {
console.log(e);
});
由于动态添加按钮,我不能这样做;
codepen.io http://codepen.io/neilhem/pen/bdGYPq 中的示例
jQuery版本2.1.3
我不知道这是解决这个问题的最佳方法,但是添加了指针事件:无; svg元素解决了问题.
svg.icon {
pointer-events: none;
}
翻译自:https://stackoverflow.com/questions/29814709/click-event-not-fired-on-button-with-svg-element-in-safari
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- Layx v2.4.8 发布!支持按钮“键盘回车”触发
- 触发器
- jQuery 自动触发事件实例
- Oracle触发器详细讲解
- react事件系统之事件触发
- 窗口实用触发器:ContinuousEventTimeTrigger
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Is Parallel Programming Hard, And, If So, What Can You Do About
Paul E. McKenney
The purpose of this book is to help you understand how to program shared-memory parallel machines without risking your sanity.1 By describing the algorithms and designs that have worked well in the pa......一起来看看 《Is Parallel Programming Hard, And, If So, What Can You Do About 》 这本书的介绍吧!