-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.js
41 lines (37 loc) · 1.17 KB
/
demo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$(function () {
$('.horizontal input.switch').switcher({
customClass: 'netkata-switcher',
toggledOn: function() {
$(this).parent().parent().find('.toggleTarget').removeAttr('disabled');
},
toggledOff: function() {
$(this).parent().parent().find('.toggleTarget').attr('disabled', 'disabled');
}
});
$('.vertical .switch').switcher({
customClass: 'netkata-switcher',
position: 'vertical',
swapOnOff: true,
toggledOn: function() {
$(this).parent().parent().find('.toggleTarget').removeAttr('disabled');
},
toggledOff: function() {
$(this).parent().parent().find('.toggleTarget').attr('disabled', 'disabled');
}
});
$('.toggle-switch').click( function ( event ) {
event.preventDefault();
$(this).parent().parent().find('input.switch').switcher('toggle');
} );
$('.toggle-on-switch').click( function ( event ) {
event.preventDefault();
Switcher.prototype.toggleOn = function() {
console.log( 'toggledon' );
};
$(this).parent().parent().find('input.switch').switcher('toggleOn');
} );
$('.toggle-off-switch').click( function ( event ) {
event.preventDefault();
$(this).parent().parent().find('input.switch').switcher('toggleOff');
} );
});