Archives for Friday, November 23rd, 2007
You are currently browsing 2 article(s) published on Friday, November 23rd, 2007, please try the search if you can't fint what you're looking for.
Opera Mini Better CSS-support than Opera?
Friday, November 23, 2007
I was checking my site in the Opera Mini 4 Simulator and noticed that Opera Mini has support for the :last-child pseudo class. Something that Opera (9.24) still does not have.
TF?
jQuery Color Picker Plug-In
Friday, November 23, 2007
A simple colour-picker plug-in for jQuery. Use it like this: $('select[name="colour"]').colourPicker();
Where the XHTML looks like this:
<form method="post" action="">
<p>
<label>Select a Colour<br />
<select name="colour">
<option value="ff0000">Red</option>
<option value="00ff00">Green</option>
<option value="0000ff">Blue</option>
</select>
</label>
</p>
</form>
And the colourPicker plug-in will turn the select in to a normal input[type="text"] and add a colour-picker icon to the right of it. Clicking the icon will bring up a dialog box allowing you to select any of the colours that were present in the select-element.
You can check it out in action here.
It requires jQuery and you can get the code here. The default styling of the colour-picker can be found here but it's very easy to apply your own styling using the default as a guide.
And as a bonus, here's a little PHP-function that will generate a list of "web-safe" colours:
<?php
function gwsc() {
$cs = array('00', '33', '66', '99', 'CC', 'FF');
for($i=0; $i<6; $i++) {
for($j=0; $j<6; $j++) {
for($k=0; $k<6; $k++) {
$c = $cs[$i] .$cs[$j] .$cs[$k];
echo "<option value="$c">#$c</option>n";
}
}
}
}
?>
Use it like this:
<select name="colour">
<?php gwsc(); ?>
</select>
Enjoy, and do leave some feedback.
- Comments are off
- Filed under Accessibility, Javascript, jQuery, Progressive Enhancement







