Home >Web Front-end >CSS Tutorial >Why Doesn't My `animate` Function Work in Chrome, but Works in Internet Explorer?
animate Function Not Working in Chrome But Works in IE
In this scenario, the animate function doesn't operate in Chrome, but it functions flawlessly in Internet Explorer. The issue stems from a shadowing conflict between the global animate function and the Element.prototype.animate function introduced in Web Animations.
To resolve this issue, consider the following steps:
function animateElement() { var div = document.getElementById('demo'); div.style.left = "200px"; div.style.color = "red"; }
document.getElementById('demo').addEventListener('click', animateElement);
The above is the detailed content of Why Doesn't My `animate` Function Work in Chrome, but Works in Internet Explorer?. For more information, please follow other related articles on the PHP Chinese website!