Skip to content

Commit

Permalink
Fix #564
Browse files Browse the repository at this point in the history
Tentatively adding support for images.

Adding an attribute `data-image-src` to the option element with the
image source url will pull that image into the menu next to that check
box.
  • Loading branch information
Michael committed Mar 21, 2017
1 parent a5f3e0c commit e093745
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions jquery.multiselect.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
.ui-multiselect-checkboxes { overflow-y:auto; position:relative; }
.ui-multiselect-checkboxes label { border:1px solid transparent; cursor:default; display:block; padding:3px 1px; }
.ui-multiselect-checkboxes label input { position:relative; top:1px }
.ui-multiselect-checkboxes label img { height: 30px; vertical-align: middle; padding-right: 3px;}
.ui-multiselect-checkboxes li { clear:both; font-size:0.9em; list-style: none; padding-right:3px; }
.ui-multiselect-checkboxes .ui-multiselect-optgroup { padding: 3px; }
.ui-multiselect-columns { display: inline-block; vertical-align: top; }
Expand Down
6 changes: 5 additions & 1 deletion src/jquery.multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,11 @@
"aria-disabled": isDisabled ? "true" : null
}).data($(option).data()).appendTo($label);

$("<span/>").text($(option).text()).appendTo($label);
var $span = $("<span/>").text($(option).text());
if($input.data("image-src")) {
$span.prepend($("<img/>").attr({"src": $input.data("image-src")}));
}
$span.appendTo($label);

return $item;
},
Expand Down

0 comments on commit e093745

Please sign in to comment.