SyntaxError:意外的输入结束(可能缺少大括号)

时间:2013-05-14 23:02:38

标签: javascript jquery

我从2天开始就遇到这个错误了,我的眼睛找不到故障......我想我错过了一个支架,我做了一些测试,但没有一个是结论性的。我希望你有比我更好的眼睛来发现故障...

这是脚本。我已经使用jQuery来制作一些带有一些块的动画并调整页面的高度。没什么特别的!

var jq = jQuery.noConflict();
jq(document).ready(function () {
    var m = 0;
    var ss = 0;
    var w = jq(window).width();
    var h = jq(window).height();
    jq("#blShuffleSong").css("width", w + 'px');
    jq("#blMG").css("width", w + 'px');
    jq("#blProject").css("width", w * 2 + 'px');
    var cd = 0;
    if (h < 585) {
        h = 585;
    } // Anti-Bleuark

    jq("#showMG").click(function () {
        if (ss == 1 && cd == 0) {
            shuffleSongtoMG();
        } else if (m == 0 && cd == 0) {
            showMG();
        } else if (m == 1 && cd == 0) {
            hideMG();
        };
    })

    jq("#showShuffleSong").click(function () {
        if (ss == 1 && cd == 0) {
            hideShuffleSong();
        } else if (m == 1 && cd == 0) {
            misterGladtoShuffleSong();
        } else if (m == 0 && cd == 0) {
            showShuffleSong();
        };
    })

    jq("#showMG").click(function () {
        if (m == 0 && cd == 0) {
            jq("#LEFTPRO").css("left", w + 'px');
            jq("#LEFTPRO").animate({
                left: '10px'
            }, 800, 'easeInOutQuint');
        }
    });

    //        jq(".linkFrancais").click(function(){
    //            hmove = h * 0.60;
    //            jq("#Home").animate({marginTop: hmove+'px'}, 500);
    //        });

    function showMG() {
        m = 1;
        cd = 1;
        jq("#INEEDTOSEEMOARPROJECTDAWG").animate({
            height: h + 'px'
        }, 300);
        jq("#blProject").css("marginLeft", w + 'px');
        jq("#blockMG").css("display", "block");
        jq("#blProject").css("display", "block");
        jq("#blProject").animate({
            marginLeft: '0px'
        }, 700, 'easeInOutQuint');
        next(1000);
    }

    function showShuffleSong() {
        ss = 1;
        cd = 1;
        jq("#INEEDTOSEEMOARPROJECTDAWG").animate({
            height: h + 'px'
        }, 300);
        jq("#blProject").css("marginLeft", w + 'px');
        jq("#blockShuffleSong").css("display", "block");
        jq("#blockMG").css("display", "block");
        jq("#blProject").css("display", "block");
        jq("#blProject").animate({
            marginLeft: '-' + w + 'px'
        }, 700, 'easeInOutQuint');
        next(1000);
    }

    function misterGladtoShuffleSong() {
        m = 0;
        ss = 1;
        cd = 1;
        jq("#blockShuffleSong").css("display", "block");
        jq("#blProject").animate({
            marginLeft: w + 'px'
        }, 700, 'easeInOutQuint', function () {
            jq("#blockMG").css("display", "block");
        });
        next(700);
    }

//Braces won't be closed at this point

    function shuffleSongtoMG() {
        ss = 0;
        m = 1;
        cd = 1;
        jq("#blockMG").css("display", "block");
        jq("#blProject").animate({
            marginLeft: '0px'
        }, 700, 'easeInOutQuint', function () {
            jq("#blockShuffleSong").css("display", "none");
        });
        next(700);
    }

    function hideMG() {
        m = 0;
        cd = 1;
        jq("#blProject").animate({
            marginLeft: w + 'px'
        }, 700, 'easeInOutQuint', function () {
            jq("#blockMG").css("display", "none");
            jq("#blProject").css("display", "none");
            jq("#INEEDTOSEEMOARPROJECTDAWG").animate({
                height: '315px'
            }, 300);
        });
        next(1000);
    }

    function hideShuffleSong() {
        ss = 0;
        cd = 1;
        jq("#blockMG").css("display", "block");
        jq("#blProject").animate({
            marginLeft: w + 'px'
        }, 1400, 'easeInOutQuint', function () {
            jq("#blProject").css("display", "none");
            jq("#blockShuffleSong").css("display", "none");
            jq("#blockMG").css("display", "none");
            jq("#INEEDTOSEEMOARPROJECTDAWG").animate({
                height: '315px'
            }, 300);
        });
        next(1700);
    }

    function next(t) {
        setTimeout(function () {
            cd = 0
        }, t);
    }

    function getSize(c) {
        var w = jq(window).width();
        var h = jq(window).height();
        var hp = 0;
        var wp = 0;
        if (h < 500) {
            hp = 500 + 'px'
        } else {
            hp = h + 'px';
        }
        jq("#LEFIRSTPAGE").css("height", hp);
        if (w < 990) {
            wp = 990 + 'px'
        } else {
            wp = w + 'px';
        }
        jq("#LEFIRSTPAGE").css("width", wp);
        if (c == 1) {
            jq("#topContainer").css("height", h * 0.40);
        };
        hbc = h * 0.60;
        hbc = hbc - 140;
        hbc = hbc / 2;
        if (c == 1) {
            jq("#bottomContainer").css("padding", hbc + 'px 0px');
        };
    }
}

在添加最新功能以适应某些块的高度之前,所有动画功能都有效。

感谢任何想要帮助我的人(以及花时间阅读此内容的其他人)

1 个答案:

答案 0 :(得分:0)

您在脚本末尾缺少);

jq(document).ready(function () {
...
});

希望这有帮助!