I have slider and each slider contains video as background and play/pause buttons. Trying to play video by clicking proper button, but I get this behavior: I click play button from the second slide and video plays from the first slide. The same is for pause button. Advice please how can I fix this bug?
[].forEach.call(document.getElementsByClassName('play'), function(element, index) {
element.onclick = function() {
document.getElementsByTagName('video')[index].play();
}
});