Converted toggle switch into a blade/jquery template

This commit is contained in:
Dan Brown
2016-12-22 19:41:32 +00:00
parent 08c4b9ac7c
commit 242dc21876
5 changed files with 21 additions and 40 deletions

View File

@ -149,6 +149,18 @@ $(function () {
window.open($(this).attr('href'));
});
// Toggle Switches
let $switches = $('[toggle-switch]');
if ($switches.length > 0) {
$switches.click(event => {
let $switch = $(event.target);
let input = $switch.find('input').first()[0];
let checked = input.value !== 'true';
input.value = checked ? 'true' : 'false';
$switch.toggleClass('active', checked);
});
}
// Detect IE for css
if(navigator.userAgent.indexOf('MSIE')!==-1
|| navigator.appVersion.indexOf('Trident/') > 0