元名称的动画="theme-color"
Animation of meta name="theme-color"
我想使用由多种颜色组成的动画,<meta name="theme-color" content="...">
例如:#87CEFA、#1E90FF、#4169E1...
是否可以在 Android 上为 Chrome 中的 theme-color
设置动画?
最后,我使用以下 JavaScript 代码找到了解决此问题的方法。使用此代码,浏览器 URL 栏上的 3 theme-colors 会动态变化。
var themeColorTest = new function() {
function e() {
"#87CEFA" === $themeColor.content ? $themeColor.content = "#1E90FF" : "#1E90FF" === $themeColor.content ? $themeColor.content = "#4169E1" : $themeColor.content = "#87CEFA",
setTimeout(e, 500)
}
this.init = function() {
$themeColor = document.querySelector("meta[name='theme-color']"),
e()
}
};
themeColorTest.init();
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Animation of meta name theme-color</title>
<meta name="theme-color" content="#87CEFA" />
</head>
<body>
<p>More info on the <code>theme-color</code> meta tag is at this <a href="https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android?hl=en">Google Developers Blog Post</a>.</p>
</body>
</html>
我想使用由多种颜色组成的动画,<meta name="theme-color" content="...">
例如:#87CEFA、#1E90FF、#4169E1...
是否可以在 Android 上为 Chrome 中的 theme-color
设置动画?
最后,我使用以下 JavaScript 代码找到了解决此问题的方法。使用此代码,浏览器 URL 栏上的 3 theme-colors 会动态变化。
var themeColorTest = new function() {
function e() {
"#87CEFA" === $themeColor.content ? $themeColor.content = "#1E90FF" : "#1E90FF" === $themeColor.content ? $themeColor.content = "#4169E1" : $themeColor.content = "#87CEFA",
setTimeout(e, 500)
}
this.init = function() {
$themeColor = document.querySelector("meta[name='theme-color']"),
e()
}
};
themeColorTest.init();
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Animation of meta name theme-color</title>
<meta name="theme-color" content="#87CEFA" />
</head>
<body>
<p>More info on the <code>theme-color</code> meta tag is at this <a href="https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android?hl=en">Google Developers Blog Post</a>.</p>
</body>
</html>