Comparing multiple variables and assigning new values respectively
Introduce a function:

var boundedIncrement = function(current, maximum) {
    return current === maximum ? 0 : current + 1;
};


Then use it:

if (forward) {
    counter = boundedIncrement(counter, listEnd);
    nextCounter = boundedIncrement(nextCounter, listEnd);
    prevCounter = boundedIncrement(prevCounter, listEnd);
}


No more logic duplication.

You could also close over listEnd if you wanted to have a single argumented function:

if (forward) {
    var boundedIncrement = function(current) {
         return current === listEnd ? 0 : current + 1;
    };
    counter = boundedIncrement(counter);
    nextCounter = boundedIncrement(nextCounter);
    prevCounter = boundedIncrement(prevCounter);
}