mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 17:23:04 +02:00
fixes #561, font icons for radio buttons
Use the following syntax in HTML:
<label class="font-checkbox">
<span class="icon-dot-circled"></span>
<input type="radio" name="radio-name" value="my-value"{if template condition} checked="checked"{/if}>
A nice label
</label>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
jQuery.fn.fontCheckbox = function() {
|
||||
this.find('input[type=checkbox], input[type=radio]').each(function() {
|
||||
/* checkbox */
|
||||
this.find('input[type=checkbox]').each(function() {
|
||||
if (!jQuery(this).is(':checked')) {
|
||||
jQuery(this).prev().toggleClass('icon-check icon-check-empty');
|
||||
}
|
||||
@@ -7,9 +8,23 @@ jQuery.fn.fontCheckbox = function() {
|
||||
this.find('input[type=checkbox]').on('change', function() {
|
||||
jQuery(this).prev().toggleClass('icon-check icon-check-empty');
|
||||
});
|
||||
|
||||
/* radio */
|
||||
this.find('input[type=radio]').each(function() {
|
||||
if (!jQuery(this).is(':checked')) {
|
||||
jQuery(this).prev().toggleClass('icon-dot-circled icon-circle-empty');
|
||||
}
|
||||
});
|
||||
this.find('input[type=radio]').on('change', function() {
|
||||
jQuery(this).closest('.font-checkbox').find('input[type=radio][name='+ jQuery(this).attr('name') +']')
|
||||
.prev().toggleClass('icon-check icon-check-empty');
|
||||
jQuery('.font-checkbox input[type=radio][name='+ jQuery(this).attr('name') +']').each(function() {
|
||||
jQuery(this).prev().removeClass();
|
||||
if (!jQuery(this).is(':checked')) {
|
||||
jQuery(this).prev().addClass('icon-circle-empty');
|
||||
}
|
||||
else {
|
||||
jQuery(this).prev().addClass('icon-dot-circled');
|
||||
}
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user