Answer the question
In order to leave comments, you need to log in
How to scroll elements relative to parent?
There is a block with a fixed width that can be scrolled, it has 5 elements.
There are 5 buttons, is it possible to make the block scroll to the 5th element when you click on the 5th button, for example?
Answer the question
In order to leave comments, you need to log in
document.onclick = function(event){
if (event.target.tagName === 'A' || event.target.closest('a')) {
let isLeaving = confirm(`do you want go to ${event.target.closest('a').href} ?`);
if (!isLeaving) return false;
}
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question