can e.preventDefault() be reversed?

后端 未结 3 1895
旧巷少年郎
旧巷少年郎 2021-01-18 11:19

i am looking for a way to .preventDefault() to make a transition and then allow the default behavior

$(\'.withTrans\').click(function(e){
    e.preventDeault         


        
3条回答
  •  醉酒成梦
    2021-01-18 11:45

    $('.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");
        });
    });
    

提交回复
热议问题