我这里使用的CSS的:用JavaScript触发CSS动画?
@keyframes themesappear{
0% {
opacity: 0;
} 100% {
opacity: 1;
}
}
@-webkit-keyframes themesappear{
0% {
opacity: 0;
} 100% {
opacity: 1;
}
}
和JavaScript这里:
var theme = function() {
document.getElementById('themes').style.animation = "themesMappear 2s forwards;";
document.getElementById('themes').style.WebkitAnimation = "themesappear 2s forwards;";
};
在企图使id为 “主题” 淡入和出现在div ...
问题是onclick不起作用,并且透明度也没有改变,我该如何解决这个问题?你可以看到网站here
我如何使用onlclick:<h1 id = "WM" onclick = "theme()">Change Theme</h1>
你能告诉你如何使用'onclick'? – putvande
@putvande我补充说。 – JakAttk123