jQuery - SyntaxError:意外的输入结束

时间:2013-05-27 04:06:03

标签: jquery

我需要帮助修复我的jQuery脚本。我不确定jQuery的规则。运行此脚本后,我需要它循环。

    <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>

1 个答案:

答案 0 :(得分: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