let videoSrc = '';
let videoImg = '';
$('.cucina').on('click', function (event) {
const target = $(event.target);
if (target.is(".cucina__link")) {
videoImg = target.attr('data-image');
videoSrc = target.attr('data-link') + '?rel=0&showinfo=0&autoplay=1';
console.log(videoSrc);
$('.cucina-modal__img img').attr('src', videoImg);
$('.cucina-modal').fadeIn();
$('body').css({
'overflow': 'hidden',
'paddingRight': '14px'
});
}
if (target.is('.cucina-modal__play img')) {
$('.cucina-modal__play').fadeOut();
$('.cucina-modal__close').fadeOut();
$('.cucina-modal__img').fadeOut();
$('.cucina-modal iframe').attr('src', videoSrc);
}
});
$('.cucina-modal__close').on('click', function () {
$('.cucina-modal').fadeOut();
$('body').css({
'overflow': 'visible',
'paddingRight': '0'
});
});
let changeSmallMenuItem = function (counter) {
const elemLength = $('.small-menu__item').length - 1;
let counterInerval = setInterval(() => {
if (counter === elemLength) {
clearInterval(counterInerval);
} else {
console.log(counter++);
}
}, 1000);
};
$('.small-menu a').hover(function () {
changeSmallMenuItem(counter);
}, function () {
counter = 2;
});