PHP CSS Colour Shuffle array?

leyprodanet

New Member
In a website i have a PHP snippet that on every refresh, certain elements change colour (div's links, text, hover states ect). This works fine but at the moment, on refresh they change to my themes colour by applying them to the the to css where necessary (examples below).I now have a jQuery function for hover states which animates and all my link:hover states they are included in the colour shuffle. When the colour shuffle is applied though it's the default 'red','blue','green' if you were to put them in the css.I have had a look online but i am unsure of where else to look as it is working just not on the jQuery snippet so i assume it's something to do with the jQuery function.PHP at top of header:\[code\]<?php $colours = array('red', 'yellow', 'pink', 'blue', 'green'); shuffle($colours); $random = $colours[0]; ?>\[/code\]On the body tag it's echoed as an id:\[code\]<body id="<?php echo $random; ?>">\[/code\]Link \[code\]*<script type="text/javascript" src="http://stackoverflow.com//ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script>*\[/code\]And on any div's or elements i want them to change colour before them in the css is #green,#red ect and the colour so if i wanted the 'share class' to change my css is like this:\[code\]#green .share { color:#79b74c;}#red .share { color:#900;}\[/code\]Now this all works apart from my hover shuffle states with the jQuery function:\[code\]$(document).ready(function(){ // colour rollover navigation $(".share").hover(function() { $(this).stop().animate({ 'color': "<?php echo $random; ?>" }, 300); },function() { $(this).stop().animate({ 'color': "#fff" }, 300); });\[/code\]It must be something to do with the jQuery as it works well when it's removed, and does work when applied but it's taking the colours from the php as css's default colour hex codes.Thanks.
 
Top