Slide show on jQuery does not work

Asked

Viewed 58 times

2

I’m doing a slide show on jQuery but it doesn’t work, the browser has error in line 2, but the syntax is correct.

Note: the same code is being used on another PC and is working normal.

//Mostra os botões de controle.3
$(document).ready(function(){

    var liwidth = $('#galeria li').outerWidth()
        speed = 5000,
        rotate = setInterval(auto, speed);

    $('#galeria').hover(function(){
        $('#buttons').fadeIn();
    //  clearInterval(rotate);
    }, function(){
        $('#buttons').fadeOut();
        //setInterval(auto, speed);
});     

    //Botão avançar 
$('.next').click(function(e){
    e.preventDefault(); //Cancela a função padrão da tag <a>. Assim, quando o botão for clicado, a page não mudará. 

     var liwidth = $('#galeria li').outerWidth(); //Pega a width no seletor section#galery li. Caso essa width mude, a variável pegará o novo valor.

    $('#galeria ul').width('99999%').animate({left:-liwidth}, function(){ //Aumenta a width da ul, deixando as img's lado a lado, e as move para a esquerda. 
        $('#galeria li').last().after($('#galeria li').first()); //Troca a ordem das img's.
        $(this).css({'left':'0', 'width':'auto'});
    }); 
});

    //Botão voltar
$('.prev').click(function(e){
        e.preventDefault();

        var liwidth = $('#galery li').outerWidth();

        $('#galeria li').first().before($('#galeria li').last().css({'margin-left':-liwidth}));
        $('#galeria ul').css({'width':'99999%'}).animate({left:liwidth}, 
        function(){
            $('#galeria li').first().css({'margin-left':'0'});
            $(this).css({'left':'0', 'margin':'auto'});
    });
});
        //Executa o slideshow automaticamente.
        function auto(){
            $('.next').click();
        }
});
  • 3

    What is line 2 there? Which browser are you accusing and which error?

  • missing a comma between $('#galeria li').outerWidth() and speed =

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.