Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery if else colour shuffle (passing a variable)
    primarykey
    data
    text
    <p>This is regarding this question i asked on this link:<a href="https://stackoverflow.com/questions/15900452/php-css-colour-shuffle-array">PHP CSS Colour Shuffle array?</a></p> <p>I have changed and added more code and have a different question hence why i've opened a new thread.</p> <p>I am using php and jQuery to shuffle colours every time the page is refreshed. At the moment this works fine. But i have a jQuery function where i grab some elements and on a hoverstate show the shuffle colour. Now this does work but it's showing css standard default red,blue,green ect and not even displaying colours for the orange. I have been advised to create a variable and then create an if function and pass the variable through the hover function. Below is what i have so far, im a novice user at jQuery so i am unsure of where i am going wrong or where to go next, can someone guide me to why this is broken? My firebug shows no errors and i think im nearly there! Thanks.</p> <p>PHP Shuffle colours:</p> <pre><code>&lt;?php $colours = array('red', 'green', 'blue', 'black'); $blog = $colours[array_rand($colours, 1)]; ?&gt; &lt;body id="&lt;?php echo $blog; ?&gt;"&gt; </code></pre> <p>In my css wherever i wanted to show the shuffle colour #green, #red is before the actuallid,class or element and it works! Just the hover states now where i have this jQuery..</p> <p>// colour rollover navigation</p> <pre><code>var colours = "&lt;?php echo $colours; ?&gt;"; if(colours == "red"){ colours = "#600"; } else if(colours == "green"){ colours = "#363"; } else if(colours == "blue"){ colours = "#369"; } else if(colours == "black"){ colours = "#000"; } //example of some elements that would use the hover effect $("#footer .address #breadcrumbs a").hover(function() { $(this).stop().animate({ 'color': colours }, 300); },function() { $(this).stop().animate({ 'color': "#fff" }, 300); }); </code></pre> <p>Am i missing some lines in the if else or passing the variable through wrong? Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload