1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-30 19:30:25 +02:00

Added Bootstrap Switch.

This commit is contained in:
Lóna Lore
2017-01-28 10:23:53 +01:00
parent 98aa0f1c57
commit ac5f2ed3da
5 changed files with 188 additions and 29 deletions

31
e107_web/js/bootstrap.switch.init.js vendored Normal file
View File

@@ -0,0 +1,31 @@
var e107 = e107 || {'settings': {}, 'behaviors': {}};
(function ($)
{
/**
* @type {{attach: e107.behaviors.bootstrapSwitchInit.attach}}
*/
e107.behaviors.bootstrapSwitchInit = {
attach: function (context, settings)
{
if(typeof settings.bsSwitch === 'undefined' || settings.bsSwitch.length == 0)
{
return;
}
$.each(settings.bsSwitch, function (name, options)
{
$('input[name="' + name + '"]', context).once('bootstrap-switch-init').each(function ()
{
$(this).bootstrapSwitch({
size: options.size || 'mini',
onText: options.onText || null,
offText: options.offText || null
});
});
});
}
};
})(jQuery);