11
rated 0 times
[
14]
[
3]
/ answers: 1 / hits: 15703
/ 12 Years ago, tue, september 25, 2012, 12:00:00
I have an object filled with various elements that I wish to iterate through using each()
and then perform an action on the element whose turn it is. So:
var arts = $(#press-sqs > article);
shuffle(arts);
$(arts).each(function(){
setInterval(function() {
// in here perform an action on the current element in 'arts'
}, 2000);
});
( shuffle()
is a basic shuffle function )
What I can't figure out is how to access the current element as a selector and perform an action on it. $(this)
is $(window)
.
Finally I would then need the function to start the iteration again once it reaches the end of art
and keep on looping ad infinitum.
More From » jquery