.nav-head:hover ~ .nav-submenu {
display: block
}
.nav-item:hover .nav-submenu {
display: block
}
$('.item').on('mouseover', '.dot', function({ delegateTarget: t }) {
$('.thumb-target', t).attr('src', $(this).data('img'));
$('.dot', t).removeClass('select').filter(this).addClass('select');
});
document.querySelectorAll('.item').forEach(n => {
n.addEventListener('mouseover', onMouseOver);
});
function onMouseOver({ target: t, currentTarget: ct }) {
const dot = t.closest('.dot');
if (dot) {
ct.querySelector('.thumb-target').src = dot.dataset.img;
ct.querySelectorAll('.dot').forEach(n => {
n.classList.toggle('select', n === dot);
});
}
}
const nav = document.querySelector('.nav');
const itemSelector = '.nav-link';
const image = document.querySelector('.preview-img');
const category = document.querySelector('.preview-head');
function updatePreview(data) {
image.src = data.img;
category.textContent = data.category;
}
nav.querySelectorAll(itemSelector).forEach(function(n) {
n.addEventListener('mouseenter', this);
}, e => updatePreview(e.target.dataset));
nav.addEventListener('mouseover', e => {
const data = e.target.closest(itemSelector)?.dataset;
if (data) {
updatePreview(data);
}
});
$(".btn").click(function () {
$(this).parent().prevAll().find(".menu").removeClass("active");
$(this).parent().nextAll().find(".menu").removeClass("active");
$(this).next().toggleClass("active");
});
.menu.active {
display: block;
}