Jquery – Simple JQuery Fade ticker

jqueryjquery-uiticker

I've looked at multiple tickers and they are all far to weighted. I'm after a very simple fadeIn() fadeOut() JQuery ticker for a list of elements to display titles.

<li>Story 1</li>
<li>Story 2</li>
<li>Story 3</li>
<li>Story 4</li>
<li>Story 5</li>

I looked at the next function but I don't know how to make it show the elements I want. So I'm after something very simple. All it needs is an interval a fade out and a fade in on a loop.

Best Solution

I did a very simple fader, very light weight. used it for images but changed it for divs:

Script

var aniSpd01 = 1000;
var fadeSpd01 = 1000;

$(function() {
    var startIndex = 0;
    var endIndex = $('#aniHolder div').length;
    $('#aniHolder div:first').fadeIn(fadeSpd01);

    window.setInterval(function() {
    $('#aniHolder div:eq(' + startIndex + ')').delay(fadeSpd01).fadeOut(fadeSpd01);
        startIndex++;
        $('#aniHolder div:eq(' + startIndex + ')').fadeIn(fadeSpd01);

        if (endIndex == startIndex) startIndex = 0;
    }, aniSpd01);
});

HTML

<div id="aniHolder">
    <div>Story 1</div>
    <div>Story 2</div>
    <div>Story 3</div>
</div>

CSS

#aniHolder {width:640px; height:480px; }
#aniHolder div {position:absolute; width:640px; height:480px; display:none;}