Past proposed changes.
[ ... ]
Markup examples:
<input type="checkbox" class="toggle blue" name="gauze" />
A current consensus?
[ ... ]
<select name="gauze" class="toggle">
<option value="On" class="blue">On</option>
<option value="Off" class="orange">Off</option>
</select>
Anyone else have any ideas?On Tue, Oct 20, 2009 at 3:25 AM, Mark Tomlin <dyg...@gmail.com> wrote:
<select name="gauze" class="toggle">
<option value="On" class="blue">On</option>
<option value="Off" class="orange">Off</option>
</select>
I don't think there will be a consensus until people have compared
working examples of each approach. Or at least a working example of an
approach other than the current one.
> Sean Gilligan suggested the use of option elements. I like this idea
> as it allow for more then two values to be placed into the current
> format (future proofing the element)
I'm not so sure how important more than two choices are for the
"toggle". A slider with more than two positions would be useful, but
could be implemented separately from the "toggle". The reason I
recommended the select/option was so the ON/OFF labels would be in the
element and localizable.
> and the use of CSS gradients for the background color was a masterful
> stroke on his part. Seeing as it's supported in all webkit browers,
> and as of FF 3.6 we will have a gecko counterpart as well.
The gradient would be a stylesheet implementation and those wishing to
support older iPhone OS or other browsers could still use images.
> I can't think of a way to make the child elements (option) take over
> the select area. effectively when you click on the toggle switch it
> would jump to the next option in the list.
> Markup examples:
>
> <select name="gauze" class="toggle">
> <option value="On" class="blue">On</option>
> <option value="Off" class="orange">Off</option>
> </select>
>
> Now if only I could make that work.
Do you have a link to a page that demonstrates the problem and your
work-in-progress? I don't know if it will be possible to make
select/option approach work (i.e. look like a toggle) without
JavaScript. It might be necessary to hide the select/option and add
elements to the DOM to get the appearance correct. With JS disabled
you'd still be able to use the form, but it would not have the "toggle".
-- Sean