I have a website that dynamically creates a list of messages, and I do not have access to a function that creates content, so I need to work with what is displayed.
<div id="wrap"> <div>Item 1</div> <div>Item 2</div> ... <div>Item 20</div> <div>Item 21</div> </div>
The function creates 21 elements in a list format (one on top of the other). What I'm looking for to achieve may only have 7 visible at a time, and has a navigation arrow to shuffle through different sets of elements.
$("#wrap > div").slice(0,7).css("background","yellow"); $("#wrap > div").slice(7,14).css("background","red"); $("#wrap > div").slice(14,21).css("background","blue");
Using .slice , I was able to target a set of 7, but as far as you can hide and scroll sets, I got a little lost.
Any help would be greatly appreciated.
https://jsfiddle.net/ga8vtojg/
source share