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:
我在一个网站上的firebug中收到一个错误,我实际上已经试图解决了一年的问题。如果有人可以看看代码并告诉我哪里出错了,我将不胜感激。这是我得到的确切错误:
missing ) after argument list [Break On This Error] $("#guts").load(url, {}, function(){ $('a.ceebox').ceebox(); });
在参数列表之后[打破此错误] $(“#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");
$("nav a[href="+newHash+"]").addClass("current");
});
});
};
});
$(window).trigger('hashchange');
});
2 个解决方案
#1
1
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(); });
...
#2
0
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.
是在一个错误的地方。上面一行中的function()定义没有开口{。它就在提到的线之后。
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.
你应该遵循马特鲍尔的评论。
#1
1
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(); });
...
#2
0
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.
是在一个错误的地方。上面一行中的function()定义没有开口{。它就在提到的线之后。
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.
你应该遵循马特鲍尔的评论。