F
F
Freeman02052021-01-29 11:53:47
css
Freeman0205, 2021-01-29 11:53:47

How to prefix _active to several classes of elements at once when scrolling to a certain block?

Hello, it is necessary to animate six balls that diverge from the center when scrolling to a certain block, I put the animation in css in the prefix (_active) to each of their classes (class1_active, class2_active, etc.), tell me how to simultaneously transfer this prefix to six elements with different classes at once. There is a js code, can someone tell me to finish it?
6013ccd733e02498521895.jpeg
6013cd167e9bb593913500.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim, 2021-01-29
@Freeman0205

const animItems = // Элементы для анимации. Можете задать им общий класс и найти сразу все, можете сложить разные(с разными классами) элементы в один массив
// ..code
animItems.forEach(function(item){item.classList.add('_active')})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question