Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could roll your own pretty easily. Start with markup like so:</p> <pre><code>&lt;fieldset&gt; &lt;input type="radio" name="weather" value="sunny" /&gt; &lt;input type="radio" name="weather" value="cloudy" /&gt; &lt;input type="radio" name="weather" value="rainy" /&gt; &lt;input type="radio" name="weather" value="class-3-kill-storm" /&gt; &lt;/fieldset&gt; </code></pre> <p>Without javascript enabled, the users will get the above (you'd probably want to add some label elements so people knew what they were clicking ;). Next, loop through all of them and create the <code>&lt;a&gt;</code> elements you'll need for your icons:</p> <pre><code>$('input[name=weather]').each(function() { var radio = $(this); radio.css({display: 'none'}); var icon = $('&lt;a class="icon ' + this.value + '"&gt;&lt;/a&gt;'); icon.click(function(e) { // stop default link click behaviour e.preventDefault(); // unmark any previously selected image and mark clicked selected icon.siblings('.icon').removeClass('selected'); icon.addClass('selected'); // set associated radio button's value radio.attr('checked', 'true'); }); $(this).parent().append(icon); }); </code></pre> <p>The reason I'm using an <code>&lt;a&gt;</code> is because IE will properly respect the <code>:hover</code> CSS pseudoclass. Also on that note, I'm using CSS spriting so you'd combine your greyed and full colour images into one 40px tall image with the grey version at the top. </p> <p>The css for the <code>&lt;a&gt;</code> would look something like:</p> <pre><code>a.icon { float: left; /* width and height of your weather icons */ width: 20px; height: 20px; background-repeat: no-repeat; background-position: 0 0; } a.selected, a:hover.icon { background-position: 0 -20px; } .sunny{ background-image: url(sunny.png); } .rainy { background-image: url(rainy.png); } /* remaining weather styles */ </code></pre> <p>You can see a version using background colours <a href="http://jsfiddle.net/vBy74/" rel="nofollow noreferrer">in action here</a>.</p>
    singulars
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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