I have come across the following functions that use the scrollTo
plugin to move to a random image but don't understand the part of
the line: .scrollTo('#pic_scroller>img:eq(' + next +
')', {duration: 1000}); that I have highlighted. - the
' + next + ' part.
The full function is below. Can do a full jsfiddle if really
necessary but hoping someone will know what the parameter is doing
without needing to do that.
$(document).ready(function(){
$('#pic_container').click(function(){
var numberOfPics = $(this).find('div > img').length;
var last = $(this).data('last');
var next = Math.floor(Math.random() * numberOfPics);
if(next == last) {
next = (next + 1) % numberOfPics;
}
$(this)
.data('last', next)
.scrollTo('#pic_scroller>img:eq(' + next +
')', {duration: 1000});
});
});