6

.preventDefault() を使用して移行を行い、デフォルトの動作を許可する方法を探しています

$('.withTrans').click(function(e){
    e.preventDeault();
    $(this).animate('opacity','0',300,function(){
           e.resumeDefault();      // does something like this exist?
    });

})
4

3 に答える 3

6
$('.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");
    });
});
于 2012-03-04T15:33:11.463 に答える
1

アニメーションが完了した後にリンクをたどろうとしていると仮定します。

$('.withTrans').click(function(e){
    $(this).animate('opacity','0',300,function(){
          window.location= this.href;
    });
    return false;
});
于 2012-03-04T15:34:30.627 に答える
0
$('.withTrans').each(function(e){
    $(this).unbind();
}
于 2014-11-06T04:41:14.180 に答える