А вот проверка на hidden в моем примере не поможет ?
$('button').on('click', function() {
let elm = $(this).parent().find('.toggle'), timeout, time;
clearTimeout(timeout);
if (elm.is(':visible')) {
elm.stop().fadeOut(time);
timeout = setTimeout(() => this.firstChild.textContent = 'Показать все', time);
}
else {
elm.stop().fadeIn(time);
timeout = setTimeout(() => this.firstChild.textContent = 'Скрыть', time);
}
});
(tableDrop).fadeToggle(function() {
showV = $(this).is(':visible');
if (showV === true) {
$('i').animate({ rotDeg: 180 }, {
step: function(n) {
$('i').css({"transform" : 'rotate(' + n + 'deg', "vertical-align" : "sub"});
}, duration: 150,
}, "linear");
} else {
$('button').html('Показать<i class="fas fa-sort-down"></i>');
$('i').animate({ rotDeg: 0 }, {
step: function(n) {
$('i').css({"transform" : 'rotate('+ n + 'deg', "vertical-align" : "top"});
}, duration: 150,
}, "linear");
}
});
$('button').on('click', function() {
let elm = $('.toggle').parent().find('.toggle');
elm.fadeToggle(1000, 'linear', function(){
if (elm.is(':visible')) {
$('button').html('Скрыть<i class="fas fa-sort-down"></i>');
$('i').animate({ rotDeg: 180 }, {
step: function(n) {
$('i').css({"transform" : 'rotate(' + n + 'deg', "vertical-align" : "sub"});
}, duration: 150,
}, "linear");
}
else {
$('button').html('Показать<i class="fas fa-sort-down"></i>');
$('i').animate({ rotDeg: 0 }, {
step: function(n) {
$('i').css({"transform" : 'rotate('+ n + 'deg', "vertical-align" : "top"});
}, duration: 150,
}, "linear");
}
});
});