开发者

Firebug Error (missing ) after argument list)

I am receiving an error in firebug on a site I have literally been trying to work the kinks out of for a year. If someone could take a look at the code and tell me where I'm going wrong, I would appreciate it. Here is the exact error I am getting:

missing ) after argument list [Break On This Error] $("#guts").load(url, {}, function(){ $('a.ceebox').ceebox(); });

My script/code is below.

Thank you in advance...

$(function() {

    var newHash      = "",
        $mainContent = $("#main-content"),
        $pageWrap    = $("#page-wrap"),
        baseHeight   = 0,
        $el;

    $pageWrap.height($pageWrap.height());
    baseHeight = $pageWrap.height() - $mainContent.height();

    $("nav").delegate("a", "click", function() {
        window.location.hash = $(this).attr("href");
        return false;
    });

    $(window).bind('hashchange', function(){

        newHash = window.location.hash.substring(1);

        if (newHash) {
            $mainContent
                .find("#guts")
                .fadeOut(200, function() {
                $mainContent.hide().load(newHash + " #guts", function()
        $("#guts").load(url, {}, function(){ $('a.ceebox').ceebox(); });

 {
                        $mainContent.fadeIn(200, function() {
                            $pageWrap.animate({
                                height: baseHeight + $mainContent.height() + "px"
                            });
                        });
                        $("nav a").removeClass("current");
                       开发者_StackOverflow中文版 $("nav a[href="+newHash+"]").addClass("current");
                    });
                });
        };

    });

    $(window).trigger('hashchange');

});


Curly bracket misplaced. You had:

...
$mainContent.hide().load(newHash + " #guts", function()
        $("#guts").load(url, {}, function(){ $('a.ceebox').ceebox(); });

 {
...

Should be

...
$mainContent.hide().load(newHash + " #guts", function() {
        $("#guts").load(url, {}, function(){ $('a.ceebox').ceebox(); });
...


this line:

$("#guts").load(url, {}, function(){ $('a.ceebox').ceebox(); });

is in a wrong place. the function() definition in the line above has no opening {. It comes right after the mentioned line.

this may a working code but I don't know if the mentioned line is in the right place

$(function() {

    var newHash = "",
        $mainContent = $("#main-content"),
        $pageWrap = $("#page-wrap"),
        baseHeight = 0,
        $el;

    $pageWrap.height($pageWrap.height());
    baseHeight = $pageWrap.height() - $mainContent.height();

    $("nav").delegate("a", "click", function() {
        window.location.hash = $(this).attr("href");
        return false;
    });

    $(window).bind('hashchange', function() {

        newHash = window.location.hash.substring(1);

        if (newHash) {
            $mainContent.find("#guts").fadeOut(200, function() {
                $mainContent.hide().load(newHash + " #guts", function() {
                    $("#guts").load(url, {}, function() {
                        $('a.ceebox').ceebox();
                    });
                    $mainContent.fadeIn(200, function() {
                        $pageWrap.animate({
                            height: baseHeight + $mainContent.height() + "px"
                        });
                    });
                    $("nav a").removeClass("current");
                    $("nav a[href=" + newHash + "]").addClass("current");
                });
            });
        }

    });

    $(window).trigger('hashchange');

});

And you should follow Matt Ball's comment.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜