2011-04-07 72 views
0

我真的希望有人會知道這個答案。爲什麼FF4需要2次點擊才能觸發resizeme?另外,當玩遊戲時注意到,如果我在第二次單擊單獨圖像時單擊其抓取應該在第一次單擊/圖像上應用的調整大小設置。它在FF3,safari,chrome中很好,例如7和8。FF4要求點擊jquery爲什麼?

$(document).ready(function(){ 

$("#slideShow a").click(function() { 
var imgTitle = $(this).children('img').attr('title'); // Find the image title 
$("#thecap").html(' ' + imgTitle + ' '); 
$("#lgImage").attr('src', $(this).children('img').attr('rel')); 
$(".resizeme1").aeImageResize({ height: 372 }); 
}); 

}); 

回答

0

你應該儘量避免默認一個行動

$(document).ready(function(){ 
    $("#slideShow a").click(function() 
    { 
     var $img = $(this).children('img'), 
      imgTitle = $img.attr('title'); // Find the image title 

     $('#thecap'). 
      text(' ' + imgTitle + ' '); 

     $('#lgImage'). 
      attr('src', $img.attr('rel')); 

     $('.resizeme1'). 
      aeImageResize({ 
       height: 372 
      }); 

     return false; 
    }); 
}); 
+0

這是更好地接受'event'步入回調,並使用'event.preventDefault()'。 – 2011-04-07 23:09:14

+0

不幸的是,這是行不通的 – user520300 2011-04-07 23:13:18

+0

@Tomalak你能舉個例子嗎? – user520300 2011-04-07 23:13:52

相關問題