You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1.0 KiB
JavaScript
28 lines
1.0 KiB
JavaScript
2 years ago
|
const tableAnimation = (el) => {
|
||
|
const evenRowBGC = 'rgba(6,25,57,0.2)' === undefined ? '#ddd' : 'rgba(6,25,57,0.2)';
|
||
|
const oddRowBGC = 'rgba(8,36,75,0.2)' === undefined ? '#bbb' : 'rgba(8,36,75,0.2)';
|
||
|
const trEvenCSS = {
|
||
|
display: "flex",
|
||
|
background: evenRowBGC
|
||
|
};
|
||
|
const trOddCSS = {
|
||
|
display: "flex",
|
||
|
background: oddRowBGC
|
||
|
};
|
||
|
let oddORevenCheck = $(`${el}>.table>.tbody>.tr`).length % 2 == 0 ? 'even' : 'odd';
|
||
|
setInterval(function () {
|
||
|
$(el + '>.table>.tbody>.tr:eq(0)').slideToggle(100, function () {
|
||
|
switch (oddORevenCheck) {
|
||
|
case 'even':
|
||
|
$(this).clone().css(trEvenCSS).appendTo(el + '>.table>.tbody');
|
||
|
oddORevenCheck = 'odd';
|
||
|
break;
|
||
|
case 'odd':
|
||
|
$(this).clone().css(trOddCSS).appendTo(el + '>.table>.tbody');
|
||
|
oddORevenCheck = 'even';
|
||
|
break;
|
||
|
}
|
||
|
$(this).remove();
|
||
|
});
|
||
|
}, 2000);
|
||
|
}
|