Answer the question
In order to leave comments, you need to log in
How to find a parent?
In general, there is such a design.
When you hover over the red side, it expands and the right side narrows, and vice versa.
Everything works as it should.
But if you add one more of the same construction to HTML, it will also expand.
Tell me how to search for a parent, so that when hovering, only the side that the cursor is on expands, and not all that are on the page.
After all, do not write a separate script for each block.
Answer the question
In order to leave comments, you need to log in
https://api.jquery.com/closest/
can be written more beautifully, but for an example...
$('.left').hover(function() {
$(this).closest('.dubSec').find('.left').toggleClass('open');
$(this).closest('.dubSec').find('.right').toggleClass('close');
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question