Trying to use Element.animate()
to change background-color
, to mimic refresh effect.
Code:
const blinkOnPage = (id) => {
document.getElementById(id).animate(
[
{"background-color": '#def', color: '#def'},
], {
easing: 'ease-in-out',
duration: 200
});
}
In my test, color
works, but background-color
doesn't, how to fix it?
Never mind, just found the solution:
Change background-color
to background
works.
const blinkOnPage = (id) => {
document.getElementById(id).animate(
[
{background: '#def', color: '#def'},
], {
easing: 'ease-in-out',
duration: 100
});
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.