julik live

Labeled

Amazingly enough, the iPhone Safari does not support changing checkboxes by tapping their labels.

Geometrically speaking, a checkbox with maximum magnification in iPhone is about 3-4 millimeters wide. They shoudda'given me a laser guidance system.

In the spirit of world peace and collaboration, the kludge:

   /* http://chriscassell.net/log/2004/12/19/add_label_click.html */
   function flipBox(e) {
     if (navigator.userAgent.indexOf("iPhone") > 0 && navigator.userAgent.indexOf("Safari") > 0)  {
       var cb = e.target.getElementsByTagName('input');
       if(cb.length == 0) return true;
       for(var i = 0; i < cb.length; i++) {
         if(cb[i].getAttribute("type") == "checkbox") {
           cb[i].checked = !cb[i].checked;
         }
       }
     } else {
       return true;
     }
   }

To maximize the excitement make the label 80% of the total page width, whereby it will become a huge stateful button (you can also style it as such).

Suspects: Веб-стройка

 
comments powered by Disqus

Aspirine not included.