Как при нажатии кнопки с data-атрибутом открывать блок привязаный к нему?
<button class="btn-more" data-case="item1">подробнее</button>
<button class="btn-more" data-case="item2">подробнее</button>
<button class="btn-more" data-case="item3">подробнее</button>
<div class="portfolio__content">
<div class="block1" data-item="item1"></div>
<div class="block2" data-item="item2"></div>
<div class="block3" data-item="item3"></div>
</div>
const caseBtn = document.querySelector('.btn-more');
const caseCloseBtn = document.querySelector('.close__content');
const caseContent = document.querySelector('.portfolio__content');
caseBtn.addEventListener('click', (event) => {
event.stopPropagation();
caseContent.classList.add('case__active');
document.body.classList.add('overflowhidden');
$('ul.tabs#portfolio').appendTo('.portfolio__content .pc__container .pc__header');
});
caseCloseBtn.addEventListener('click', (event) => {
event.stopPropagation();
caseContent.classList.remove('case__active');
document.body.classList.remove('overflowhidden');
$('ul.tabs#portfolio').appendTo('.portfolio__headers');
});