2010-10-26 60 views
10

我不明白我在做什么错在这里... 3号线是报告丢失:物业ID后缺失:物业ID后

$(document).ready(function() { 

    $('#imagegallery img').each(function({$(this).css({ width: '100%'});}); 

    $('#imagegallery').cycle({ 
     timeout: 0, 
     fx: 'scrollHorz', 
     width: '100%', 
     height: 'auto', 
     next: '.next', 
     prev: '.prev' 
    }); 



    $("#imagegallery").touchwipe({ 
     wipeLeft: function() { 
      $("#imagegallery").cycle("next"); 
     }, 
     wipeRight: function() { 
      $("#imagegallery").cycle("prev"); 
     } 
    }); 
}); 

回答

15

问题是这一行:

$('#imagegallery img').each(function({$(this).css({ width: '100%'});}); 

应该是:

// missing) --------------------v 
$('#imagegallery img').each(function(){$(this).css({ width: '100%'});}); 

虽然你可以缩短这样的:

$('#imagegallery img').css({ width: '100%'}); 
+1

我会说这应该是:'$( '#imagegallery IMG')的CSS({宽度:'100%'});';) – 2010-10-26 17:37:27

+0

@Nick - 同意。刚刚完成更新。 :O) – user113716 2010-10-26 17:39:25

0

你错过了在

// $('#imagegallery img').each(function({$(this).css({ width: '100%'});}); 
// should be: 
$('#imagegallery img').each(function(){$(this).css({ width: '100%'});}); 

密切括号莫非是吗?

1

我也有一个错误显示我的功能定义如下。

test : function(a) { 
    //do something; 
} 

的错误消失:

function test(a) { 
    //do something; 
} 

我的情况下,通过将其更改为解决这个问题。

-1

右括号缺少的是每一个

$('#imagegallery img').each(function({$(this).css({ width: '100%'});});) 

或者

$('#imagegallery img').each(function({$(this).css({ width: '100%'});}));