Created
September 7, 2017 03:15
-
-
Save MarvinJWendt/1f08ba9c63e8c6a91c76fbfdef0f52f8 to your computer and use it in GitHub Desktop.
Fade android url-bar color with javascript and jquery.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var colors = ['#000000', '#080808', '#0F0F0F', '#171717', '#1F1F1F', '#262626 ', '#2E2E2E']; | |
var colors_length = colors.filter(function () { return true; }).length -1; | |
var currentColor = 0; | |
var forwards = true; | |
setInterval(function() { | |
if(forwards) | |
{ | |
$("meta[name='theme-color']").attr("content", colors[currentColor]); | |
currentColor++; | |
if(currentColor >= colors_length) | |
{ | |
forwards = false; | |
} | |
} | |
else | |
{ | |
$("meta[name='theme-color']").attr("content", colors[currentColor]); | |
currentColor--; | |
if(currentColor <= 0) | |
{ | |
forwards = true; | |
} | |
} | |
}, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment