2011-09-28 20 views
0

jQuery Easy Confirmationプラグインを使用していた人は、この問題に直面していましたか?最初のクリック後に元のクリックイベントが失われます。私はこれを動作させるためにプラグインのコードを変更しなければならなかった。ここでの違いは、.bindと.clickの違いです。なぜ誰かが説明できますか? Pls。私の質問がはっきりしないかどうか私に知らせてください。どうも!.bind()文がjQuery Easy Confirmationプラグインで動作しない

オリジナルプラグインコード:

 // Re-bind old events 
      var rebindHandlers = function() { 

       if (target._handlers != undefined) { 
        jQuery.each(target._handlers, function() { 
         //this is the difference 
         $target.bind(type, this); 
        }); 
       } 
      } 

変更(作業)コード:

// Re-bind old events 
      var rebindHandlers = function() { 

       if (target._handlers != undefined) { 
        jQuery.each(target._handlers, function() { 
         //this is the difference 
         if(type == 'click') 
          $target.click(this); 
         else { 
          $target.bind(type, this); 
         } 
        }); 
       } 
      } 

答えて

0

何が起こっているかを確認するために、いくつかの警告を使用してみてください...

// Re-bind old events 
var rebindHandlers = function() { 
      if (target._handlers != undefined) { 
       jQuery.each(target._handlers, function() { 
        if(type == 'click') 
         alert('$target.click(' + this + ');'); 
         //$target.click(this); 
        else { 
         alert('$target.bind(' + type + ', ' + this + ');'); 
         //$target.bind(type, this); 
        } 
       }); 
      } 
     } 
関連する問題