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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* ------------------------------------------------------------------------------
*
* # Single navbar
*
* Specific JS code additions for navbar_single.html page
*
* Version: 1.0
* Latest update: Aug 1, 2015
*
* ---------------------------------------------------------------------------- */
$(function() {
// Initialize switchery toggles
// ------------------------------
// Navbar type switchery toggle
var toggleType = document.querySelector('.toggle-type');
var toggleTypeInit = new Switchery(toggleType, {color: '#283133', secondaryColor: '#283133'});
// Navbar position switchery toggle
var togglePosition = document.querySelector('.toggle-position');
var togglePositionInit = new Switchery(togglePosition, {color: '#283133', secondaryColor: '#283133'});
// Change single navbar position
// ------------------------------
// Toggle navbar type state toggle
toggleType.onchange = function() {
if(toggleType.checked) {
// Disable type switch
togglePositionInit.disable();
// Toggle necessary body and navbar classes
$('body').children('.navbar').addClass('navbar-fixed-top');
$('body').addClass('navbar-top');
}
else {
// Enable type switch
togglePositionInit.enable();
// Toggle necessary body and navbar classes
$('body').children('.navbar').removeClass('navbar-fixed-top');
$('body').removeClass('navbar-top');
}
};
// Toggle navbar position state toggle
togglePosition.onchange = function() {
if(togglePosition.checked) {
// Disable position switch
toggleTypeInit.disable();
// Toggle necessary body and navbar classes
$('body').children('.navbar').addClass('navbar-fixed-bottom');
$('body').addClass('navbar-bottom');
}
else {
// Enable position switch
toggleTypeInit.enable();
// Toggle necessary body and navbar classes
$('body').children('.navbar').removeClass('navbar-fixed-bottom');
$('body').removeClass('navbar-bottom');
}
};
});