Guest User

Untitled

a guest
Feb 24th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. let pos = 0;
  2.  
  3. window.addEventListener("load", function(event) {
  4. testIt('current', 5000);
  5. });
  6.  
  7. function testIt(_class, _speed) {
  8. const testPara = document.querySelectorAll('.bg_imgs');
  9.  
  10. let i;
  11. for(i = 0; i < testPara.length; i++) {
  12. testPara[i].classList.remove(_class);
  13. }
  14.  
  15. pos++;
  16.  
  17.  
  18. if(pos > testPara.length) {pos = 1;}
  19.  
  20. testPara[pos-1].classList.add(_class);
  21.  
  22. setTimeout(_class, _speed); }
Add Comment
Please, Sign In to add comment