2012-04-16 4 views
0

で関数を実行します。私は特定の順序で3つの機能を実行したいと私はこれを行うため

function nextPage() { 
    var loading_temp = $('#loading_temp'); 

    loading_temp.show() 
     .queue(function() { 
      nextPage980() 
       .queue(function() { 
        loading_temp.hide(); 
        $(this).dequeue(); 
       }); 
      $(this).dequeue(); 
     });   
} 

「#loading_tempは」を示し、その後、関数が実行されますが、最後の関数は(ロードを隠しますgif)は実行されません!

Chromeは、このエラーを与える:キャッチされない例外TypeErrorを:

未定義nextPage980()関数の 'キュー' メソッドを呼び出すことはできませんこれは、次のとおりです。事前に

function nextPage980() { 
     var ajax_heading = $('#ajax_heading');   
     var cur_heading = $('#cur_heading');    
     var temp_heading = $('.temp_heading'); 
      var temp_heading_first = temp_heading.filter(':first');   
     var loading_temp = $('#loading_temp'); 

     var htmlHeader = "Εγκαταστάσεις";   

     ajax_heading.attr('class', 'next_temp');   
     cur_heading.css({'margin-right' : '20px'}).after('<div id="cur_heading" class="temp_heading" data-tempPos="2"><h1 class="page_heading"><span class="heading_span">' + htmlHeader + '</span></h1></div>')   
      .queue(function() { 
       ajax_heading.animate({'margin-left' : '-1000px'}, 1000, 'easeInExpo')    
        .queue(function() { 
         temp_heading_first.remove();       
         cur_heading.removeAttr('style');       
         ajax_heading.attr('class', 'cur_temp').removeAttr('style');              
         $(this).dequeue(); 
        }); 
       $(this).dequeue(); 
      });  
    } 

ありがとう!

+0

何も返さない場合、それは '未定義です。 'だからすべてうまく動作します。 – noob

答えて

1

nextPage980からjqueryオブジェクトを返すだけで済みます。無条件のreturn $(this);を最後に追加します。現状では、現在の戻り値にはqueueが呼び出されています。これは何もありません(したがって、エラーメッセージ)。

関連する問題