Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. const marker = document.querySelector('.bar-marker')
  2.  
  3. const bars = document.querySelectorAll('.bar-item');
  4.  
  5. (function() {
  6. for(let i=0; i<=bars.length; i++){
  7. if(marker.offsetLeft >
  8. bars[i].offsetLeft && marker.offsetLeft <
  9. bars[i].offsetWidth+bars[i].offsetLeft){
  10. bars[i].classList.add('bar-item--selected')
  11. }
  12. }
  13. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement