2010-10-26 14 views
10

non capisco quello che sto facendo male qui ... la linea 3 sta riportando manca: dopo ID proprietàmancante: dopo ID proprietà

$(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"); 
     } 
    }); 
}); 

risposta

15

Il problema è che con questa linea:

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

dovrebbe essere:

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

Anche se è possibile ridurre in questo modo:

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

direi che dovrebbe essere:. '$ ('# Galleria immagini img') css ({width : '100%'}); ';) –

+0

@Nick: concordato. Ho appena finito di aggiornare. : O) – user113716

0

vi state perdendo una stretta parentesi a

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

Che potrebbe essere vero?

1

Ho anche un messaggio di errore per la definizione della mia funzione come di seguito.

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

Il mio caso per risolvere il problema del cambiamento a:

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

L'errore è scomparso.

-1

La parentesi di chiusura manca è l'ognuna

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

O

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