ul.small-menu
li
a(href="#")
.small-menu__item
img(src="assets/i/small-menu/Prodotti.jpg" alt="")
h2 Prodotti
.small-menu__item
img(src="assets/i/small-menu/Prodotti.jpg" alt="")
h2 Prodotti
.small-menu__item
img(src="assets/i/small-menu/Prodotti.jpg" alt="")
h2 Prodotti
li
a(href="#")
.small-menu__item
img(src="assets/i/Ricette.jpg" alt="")
h2 Ricette
li
a(href="#")
img(src="assets/i/Specialita.jpg" alt="")
h2 Guida alla bistecca perfetta
let changeSmallMenuItem = function () {
let counter = 1;
const elemLength = $('.small-menu__item').length - 1;
if (counter === elemLength.length) {
console.log('counter finish');
} else {
let counterInerval = setInterval(() => {
if (counter === elemLength.length) {
console.log('counter finish');
} else {
console.log(counter++);
}
}, 1000);
}
};
$('.small-menu a').hover(function () {
changeSmallMenuItem();
}, function () {
clearInterval(countInterval);
});
const animate = ($elements, index) => {
if (index < $elements.length)
$elements.eq(index).animate({...}, {...}, () => animate($elements, index+1));
}
animate($(selector), 0);