Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I wrote a short plugin that implement vertical buttonset for radio buttons and checkboxes with jquery ui.</p> <h3>1. jQuery Plugin</h3> <pre><code>(function( $ ){ //plugin buttonset vertical $.fn.buttonsetv = function() { $(':radio, :checkbox', this).wrap('&lt;div style="margin: 1px"/&gt;'); $(this).buttonset(); $('label:first', this).removeClass('ui-corner-left').addClass('ui-corner-top'); $('label:last', this).removeClass('ui-corner-right').addClass('ui-corner-bottom'); var maxWidth = 0; // max witdh $('label', this).each(function(index){ var labelWidth = $(this).width(); if (labelWidth &gt; maxWidth ) maxWidth = labelWidth ; }) $('label', this).each(function(index){ $(this).width(maxWidth); }) }; })( jQuery ); </code></pre> <h3>2. Sample markup</h3> <pre><code>&lt;h2&gt; Radio Buttonset &lt;/h2&gt; &lt;div id="radio"&gt; &lt;input type="radio" id="radio1" name="radio" value="1"/&gt;&lt;label for="radio1"&gt;Choice 1&lt;/label&gt; &lt;input type="radio" id="radio2" name="radio" value="2"/&gt;&lt;label for="radio2"&gt;Choice 2&lt;/label&gt; &lt;input type="radio" id="radio3" name="radio" value="3"/&gt;&lt;label for="radio3"&gt;Choice 3&lt;/label&gt; &lt;/div&gt; &lt;h2&gt; Checkbox Buttonset &lt;/h2&gt; &lt;div id="checkbox"&gt; &lt;input type="checkbox" id="check1" name="check" value="1"/&gt;&lt;label for="check1"&gt;Choice 1&lt;/label&gt; &lt;input type="checkbox" id="check2" name="check" value="2"/&gt;&lt;label for="check2"&gt;Choice 2&lt;/label&gt; &lt;input type="checkbox" id="check3" name="check" value="3"/&gt;&lt;label for="check3"&gt;Choice 3&lt;/label&gt; &lt;/div&gt; </code></pre> <h3>3. Plugin Usage</h3> <pre><code>$(document).ready(function(){ //call plugin $("#radio").buttonsetv(); $("#checkbox").buttonsetv(); }); </code></pre> <p><a href="https://gist.github.com/760885" rel="nofollow noreferrer">Here the plugin and example code</a> </p> <p>I hope this can help you :)</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