Dantes (обсуждение | вклад) Нет описания правки |
Dantes (обсуждение | вклад) Нет описания правки |
||
| Строка 1: | Строка 1: | ||
document.querySelectorAll('.recipe-list li').forEach(function(item) { | document.querySelectorAll('.recipe-list li').forEach(function(item) { | ||
if ( | if (item.classList.contains('instruction')) return; | ||
if (item === item.parentElement.lastElementChild) return; | |||
if (item.querySelector('.chem-icon')) return; | |||
var icon = document.createElement('img'); | var icon = document.createElement('img'); | ||
icon.className = 'chem-icon'; | icon.className = 'chem-icon'; | ||
| Строка 9: | Строка 10: | ||
}); | }); | ||
$('.collapsible-header').click(function() { | $('.collapsible-header').click(function() { | ||
var content = $(this).next('.collapsible-content'); | var content = $(this).next('.collapsible-content'); | ||
content.slideToggle(300, function() { | content.slideToggle(300, function() { | ||
$(this).find('li').each(function(index) { | $(this).find('li').each(function(index) { | ||
$(this).css('animation-delay', index * 0.1 + 's') | $(this).css('animation-delay', (index * 0.1) + 's') | ||
.toggleClass('visible', $(this).is(':visible')); | .toggleClass('visible', $(this).is(':visible')); | ||
}); | }); | ||
}).toggleClass('active'); | }).toggleClass('active'); | ||
}); | }); | ||
Версия от 17:42, 5 мая 2025
document.querySelectorAll('.recipe-list li').forEach(function(item) {
if (item.classList.contains('instruction')) return;
if (item === item.parentElement.lastElementChild) return;
if (item.querySelector('.chem-icon')) return;
var icon = document.createElement('img');
icon.className = 'chem-icon';
icon.src = 'Beaker.png';
item.insertBefore(icon, item.firstChild);
});
$('.collapsible-header').click(function() {
var content = $(this).next('.collapsible-content');
content.slideToggle(300, function() {
$(this).find('li').each(function(index) {
$(this).css('animation-delay', (index * 0.1) + 's')
.toggleClass('visible', $(this).is(':visible'));
});
}).toggleClass('active');
});