meta name="theme-color" 的动画

我想使用由多种颜色组成的动画,例如<meta name="theme-color" content="..."> :#87CEFA、#1E90FF、#4169E1...

是否可以theme-color在 Android 上的 Chrome 中设置动画?


德玛西亚99
浏览 243回答 1
1回答

慕村225694

最后,我使用以下 JavaScript 代码找到了解决此问题的方法。使用此代码,浏览器 URL 栏上的 3 种主题颜色会动态变化。var themeColorTest = new function() {&nbsp; function e() {&nbsp; &nbsp; "#87CEFA" === $themeColor.content ? $themeColor.content = "#1E90FF" : "#1E90FF" === $themeColor.content ? $themeColor.content = "#4169E1" : $themeColor.content = "#87CEFA",&nbsp; &nbsp; &nbsp; setTimeout(e, 500)&nbsp; }&nbsp; this.init = function() {&nbsp; &nbsp; $themeColor = document.querySelector("meta[name='theme-color']"),&nbsp; &nbsp; &nbsp; e()&nbsp; }};themeColorTest.init();<!DOCTYPE html><html><head>&nbsp; <meta charset="utf-8">&nbsp; <title>Animation of meta name theme-color</title>&nbsp; <meta name="theme-color" content="#87CEFA" /></head><body>&nbsp; <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>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript