2013-05-27 45 views
-4

我需要幫助修復我的jQuery腳本。我不確定jQuery的規則。這個腳本運行後,我需要循環。jQuery - SyntaxError:意外的輸入結束

<script> 

$(document).ready(function(){ 

     var $title = $('#banner-title span').replaceWith('Testimonials'); 
    var $title2 = $('#banner-title span').replaceWith('Rental Program'); 
    var $title3 = $('#banner-title span').replaceWith('Services'); 

     $title.fadeIn('fast',function() { 
     $title.delay(7500).fadeOut('fast',function() { 
     $title2.fadeIn('fast',function() { 
     $title2.delay(7500).fadeOut('fast',function() { 
     $title3..fadeIn('fast',function() { 
     $title3.delay(7500).fadeOut('fast'); 

     }); 
    } 

</script> 
+0

這個問題沒有提供足夠的信息來回答。怎麼了? –

+1

我推薦閱讀https://developer.mozilla.org/en-US/docs/JavaScript/Getting_Started,然後http://learn.jquery.com/using-jquery-core/ – undefined

+0

'$ title3..fadeIn' - 那將不適用於雙點。 –

回答

0

看到我更新的回答你previous question

var titles = ['My Title 1', 'My Title 2'], titleFlag = 0; 
function BTTS(){ 
    $('#banner-title span').fadeOut('fast',function() { 
     titleFlag = (titleFlag + 1) % titles.length; 
     $('#banner-title span').html(titles[titleFlag]).show(); 
    }); //<-- missing ')' here 
} 

$(document).ready(function(){ 
    // RUN BTTS FUNCTION 
    setInterval(BTTS, 2000); 
}); //<-- missing ')' here 

演示:Fiddle

相關問題