I want to randomly (of a selected list) change the color of the background of my header which I've done and is working great, using this JS:
var bgcolorlist=new Array("#ef5c20", "#a7dbca", "#c5e53f", "#ffad14")
$(".cbp-hsinner").css("background-color",bgcolorlist[Math.floor(Math.random()*bgcolorlist.length)]);
but I want the same random color to apply to the 'border-top-color' of this a:after tag here:
.cbp-hsmenu > li.cbp-hsitem-open > a:after {
top: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: transparent;
border-top-color: #ef5c20;
border-width: 10px;
left: 50%;
margin-left: -10px;
}
HTML:
<nav class="cbp-hsmenu-wrapper" id="cbp-hsmenu-wrapper">
<div class="cbp-hsinner">
<div class="site-header__logo-alt"><a href="http://helloarchie.blue/"><img width="145" alt="Hello Archie" src="<?php echo theme_url('/img/HA-LOGO3.png'); ?>" /></a></div>
<ul class="cbp-hsmenu">
<li>
<a href="http://helloarchie.blue">Home</a>
</li>
<li>
<a href="#">Categories</a>
<ul class="cbp-hssubmenu">
<li><a href="http://helloarchie.blue/category/personal/"><span>Personal</span></a></li>
<li><a href="http://helloarchie.blue/category/monthly-updates/"><span>Monthly Updates</span></a></li>
<li><a href="http://helloarchie.blue/category/informative/"><span>Informative</span></a></li>
<li><a href="http://helloarchie.blue/category/reviews/"><span>Reviews</span></a></li>
<li><a href="http://helloarchie.blue/category/guides/"><span>Guides</span></a></li>
</ul>
</li>
<li>
<a href="http://helloarchie.blue/about">About</a>
</li>
<li>
<a href="#">Elsewhere</a>
<ul class="cbp-hssubmenu">
<li><a href="http://kaye.at/"><span>Portfolio</span></a></li>
<li><a href="http://kaye.at/baby/"><span>The Baby Project</span></a></li>
</ul>
</li>
</ul>
</div>
</nav>
Is this possible?