there is an array of elements with the same classes, it is necessary that every second a class is added / removed to the elements of the array in turn. How to properly describe such a function?
currently stuck on the moment:
var i = 0; setInterval(function(){ var toHover = $('.st-b > a'); var objs = toHover.map(function(){ return this; }).get(); var art = objs[i++]; // art.toggleClass('hover'); console.log(art); console.log('hover+'); setTimeout(function(){ // art.toggleClass('hover'); console.log(art); console.log('hover-'); },1000); if(i >= objs.length) i = 0; },3000); if uncomment - an error is displayed
var art = objs[i++];- Grundyvar art = objs[i++];aftervar objs = toHover.map(function(){ return this; }).get();coming naturally - wannaBproobjsstill undefined , so when you try toobjs[i++]will be an exception - Grundyart- wannaBpro