2014-01-06 19 views
0
$(document).ready(function(){ 

     $('.titleword').fadeOut(500 , function(){ 
    $('.titleword').click(function(){ 
       var str = $(this).text(); 
       var idx; 
       for (var x=0;x<5;x++) 
       { 
        if (str == categories[x]) 
        { 
         idx = x; 
        } 
       } 
       categories[idx] = $('#headertext').text(); 
       $('#headertext').text(str) 
       $(this).text(categories[idx]); 
    }); 
    $('.titleword').fadeTo(500,1); 
    }); 
}); 

nw我淡出這個類然後做一些操作,我需要的是在此操作後再次淡出。如何淡出然後重新jquery

而是搞什麼名堂做的是剛剛淡出而已,沒有

我如何能做到既操作衰落?????

+0

你爲什麼要在fadeOut()回調中設置點擊處理程序? –

+0

淡出當我點擊某個對象,然後自動淡入一些操作後! –

回答

1
$('.titleword').fadeOut(500 , function(){ 
    $('.titleword').click(function(){ 
       var str = $(this).text(); 
       var idx; 
       for (var x=0;x<5;x++) 
       { 
        if (str == categories[x]) 
        { 
         idx = x; 
        } 
       } 
       categories[idx] = $('#headertext').text(); 
       $('#headertext').text(str) 
       $(this).text(categories[idx]); 
       $('.titleword').fadeTo(500,1); //add this here 

    }); 
    $('.titleword').fadeTo(500,1); 
    }); 
+0

基本上,這隻會'fadeTo(500,1)' –

1

我覺得你的代碼應該是:

$(document).ready(function(){ 

    $('.titleword').click(function(){ 
      var str = $(this).text(); 
      var idx; 
      for (var x=0;x<5;x++) 
      { 
       if (str == categories[x]) 
       { 
        idx = x; 
       } 
      } 
      categories[idx] = $('#headertext').text(); 
      $('#headertext').text(str) 
      $(this).text(categories[idx]); 
    }); 

    $('.titleword').fadeOut(500).fadeIn(500); 
}); 

由於結合了衰落裏面點擊就沒有意義了我。然後,淡入/淡入直接。

乾杯

相關問題