Home › Forums › JavaScript › I need a completely agnostic photo slider. › Reply To: I need a completely agnostic photo slider.
Well, “whatever markup is given” is a bit of a stretch cause usually, you’re bound to some rules. Most of the time they just require you to create a list (ULs and LIs), or at the very least a container div, and then attach the JS to it. Then that would be made into a slideshow, no matter how many elements.
So, the plugin would not make a difference between this:
<div>
<img src="//malsup.github.com/images/beach1.jpg" width="200" height="200" />
<img src="//malsup.github.com/images/beach2.jpg" width="200" height="200" />
</div>
Or this:
<div>
<img src="//malsup.github.com/images/beach1.jpg" width="200" height="200" />
<img src="//malsup.github.com/images/beach2.jpg" width="200" height="200" />
<img src="//malsup.github.com/images/beach3.jpg" width="200" height="200" />
<img src="//malsup.github.com/images/beach4.jpg" width="200" height="200" />
<img src="//malsup.github.com/images/beach5.jpg" width="200" height="200" />
</div>
But again, you’re bound by markup rules (in the example above, the rule is that the images have to be contained in a container DIV.
It doesn’t get any simpler than this really: http://jquery.malsup.com/cycle/
It may not be the type of slider you’re looking for, but it shows that the number of elements is irrelevant.