Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery automatic scroll / slideshow

Could i modify this existing code to automatically scroll through the list items to display the content?

Sorry, the: ul li a {} links.

Maybe using "interval" method?

$(document).ready(function(){
    $('ul.tabNav a').click(function() {
        var curChildIndex = $(this).parent().prevAll().length + 1;
        $(this).parent().parent().children('.current').removeClass('current');
        $(this).parent().addClass('current');
        $(this).parent().parent().prev('.tabContainer').children('.current').fadeOut('fast',function() {
            $(this).parent().children('div:nth-child('+curChildIndex+')').fadeIn('fast',function() {
                $(this).addClass('current');
            });
            $(this).removeClass('current');
        });
        return false;
    });
});
like image 210
tony noriega Avatar asked Mar 27 '26 23:03

tony noriega


1 Answers

There are millions of plugins that do exactly that. Let's not reinvent the wheel and try one of these or these.

Edit: There are special timer plugins as well, take a look at this one.

like image 193
Dänu Avatar answered Apr 02 '26 03:04

Dänu