我正在寻找一种通过 .preventDefault() 进行转换然后允许默认行为的方法
$('.withTrans').click(function(e){
e.preventDeault();
$(this).animate('opacity','0',300,function(){
e.resumeDefault(); // does something like this exist?
});
})
最佳答案
$('.withTrans').click(function(event) {
if ( $(this).data("prevented") === true ) {
$(this).data("prevented", false);
return;
}
event.preventDefault();
$(this).animate('opacity', '0', 300, function() {
$(this).data("prevented", true).trigger("click");
});
});
关于javascript - e.preventDefault() 可以逆转吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9556107/