Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

missing : after property ID

I don't understand what I'm doing wrong here... line 3 is reporting missing : after property 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");
        }
    });
});
like image 684
Aaron R Avatar asked Oct 26 '10 17:10

Aaron R


2 Answers

Problem is with this line:

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

should be:

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

Although you can shorten it like this:

$('#imagegallery img').css({ width: '100%'});
like image 151
user113716 Avatar answered Oct 10 '22 09:10

user113716


I also have an error show to definition of my function like below.

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

My case to solve the problem by change it to:

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

The error is gone.

like image 36
Vincent Fan Avatar answered Oct 10 '22 09:10

Vincent Fan