tags:

views:

121

answers:

0

Hello,

I'm trying to make a news feeder that grabs 5 dynamic items at a time, fades them out and inserts the next 5. I'm using the JQuery news ticker right now, but it only grabs one child element at a time. As you can see:

/*
* JqNews - JQuery NewsTicker
* Author: Gravagnola Saverio and Iuliano Renato
* Version: 2.0 Verticale
*/


var newsVisualVertical = 5; //Number of news to be displayed
var intervalloVert = 6000; // time > 2500
var numNewsVert;

var larghezzaDivVert = 150; //width div
var altezzaDivVert = 118; //height div
var margineDivVert = 5; //margin between div


$(document).ready(function() {
    numNewsVert = $(".MultilineTable tbody").children().length;


    if (numNewsVert > 0) {
        jqnewsVertical();
    }

});

function jqnewsVertical() {
    if (newsVisualVertical > numNewsVert) {
        newsVisualVertical = numNewsVert;
    }


    for (var i = newsVisualVertical; i < numNewsVert; i++) {
        $($(".MultilineTable tbody").children()[i]).css("opacity", "0");
    }

    var gestInter = setInterval(jqNewsRotateVertical, intervalloVert);


    $(".MultilineTable tbody").mouseover(function() { clearInterval(gestInter) });
    $(".MultilineTable tbody").mouseout(function() { gestInter = setInterval(jqNewsRotateVertical, intervalloVert); });
}

function jqNewsRotateVertical() {

    $($(".MultilineTable tbody").children()[0]).animate({ opacity: 0 }, 1000, "linear", function() {

        $($(".MultilineTable tbody").children()[0]).animate({ marginTop: -altezzaDivVert }, 1000, "linear", function() {

            $($(".MultilineTable tbody").children()[0]).css("margin", margineDivVert);

            $(".MultilineTable tbody").append($($(".MultilineTable tbody").children()[0]));

            $($(".MultilineTable tbody").children()[newsVisualVertical - 1]).animate({ opacity: 1 }, 1000);
        });
    });
}

Basically, how can I set this up to grab 5 child elements instead of just 1? Thank you!