为了

2012-04-16 35 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)不执行!

铬给出了这样的错误:遗漏的类型错误:无法调用未定义

的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

如果你没有返回任何东西,它是'undefined'。所以一切正常。 – noob 2012-04-16 11:10:39

回答

1

你只需要从nextPage980返回一个jquery对象。最后添加无条件的return $(this);。就目前而言,你对当前的返回值调用queue,这是没有任何的(因此你的错误信息)。