Skip to content

Instantly share code, notes, and snippets.

@dallasbpeters
Created April 16, 2013 19:17
Show Gist options
  • Save dallasbpeters/5398755 to your computer and use it in GitHub Desktop.
Save dallasbpeters/5398755 to your computer and use it in GitHub Desktop.
Our fixes for iOS-style-checkboxes.js
iOSCheckbox.prototype.optionallyResize = function(mode) {
var newWidth, offLabelWidth, offSpan, onLabelWidth, onSpan;
+ var minSize = 30;
onSpan = this.onLabel.find('span');
onLabelWidth = this._getDimension(onSpan, "width");
+ if (onLabelWidth < minSize) { onLabelWidth = minSize; }
onLabelWidth += parseInt(onSpan.css('padding-left'), 10);
offSpan = this.offLabel.find('span');
offLabelWidth = this._getDimension(offSpan, "width");
+ if (onLabelWidth < minSize) { onLabelWidth = minSize; }
offLabelWidth += parseInt(offSpan.css('padding-right'), 10);
if (mode === "container") {
newWidth = onLabelWidth > offLabelWidth ? onLabelWidth : offLabelWidth;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment