Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

how to make this list never ending?

$(document).ready(function () {
    'use strict';
    var animTime = 1000, awidth = 145, pause = 2000, animLength = 1,

        // Creating a function anim to animate unordered list
        anim = function () {$("ul").animate({left: '-=' + awidth},animTime,anim).delay(pause);},

        stopAnim = function () {$("ul").mouseenter($("ul").stop(anim)); },

        resume = function () {$("ul").mouseleave(anim);};



              anim();

    console.log($('ul li').length);

    $("ul").hover(stopAnim, resume);
});

3 Answers

Jose Soto
Jose Soto
23,407 Points

It looks like you're trying to animate the unordered list off the screen. The current script does that as long as you have the unordered list's position value set in CSS:

ul {
     position: relative;
}

This is a working jsfiddle link.

Thanx sir for helping me, But i want to repeat the unordered list every time after the list ends

Rich Donnellan
MOD
Rich Donnellan
Treehouse Moderator 27,671 Points

I don't understand the question. Can you provide some context?

Actually, i want to make this list never ending means i want to append this list again and again followed by the same list. So that it never get off from the screen. Please help !!!!!!!!!!! and thank you for your kind responses.