forked from WebStackPage/WebStackPage.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresizeable.js
More file actions
executable file
·122 lines (88 loc) · 1.84 KB
/
resizeable.js
File metadata and controls
executable file
·122 lines (88 loc) · 1.84 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
This function will be called in the event when browser breakpoint changes
*/
var public_vars = public_vars || {};
jQuery.extend(public_vars, {
breakpoints: {
largescreen: [991, -1],
tabletscreen: [768, 990],
devicescreen: [420, 767],
sdevicescreen: [0, 419]
},
lastBreakpoint: null
});
/* Main Function that will be called each time when the screen breakpoint changes */
function resizable(breakpoint)
{
var sb_with_animation;
// Large Screen Specific Script
if(is('largescreen'))
{
}
// Tablet or larger screen
if(ismdxl())
{
}
// Tablet Screen Specific Script
if(is('tabletscreen'))
{
}
// Tablet device screen
if(is('tabletscreen'))
{
public_vars.$sidebarMenu.addClass('collapsed');
ps_destroy();
}
// Tablet Screen Specific Script
if(isxs())
{
}
// Trigger Event
jQuery(window).trigger('xenon.resize');
}
/* Functions */
// Get current breakpoint
function get_current_breakpoint()
{
var width = jQuery(window).width(),
breakpoints = public_vars.breakpoints;
for(var breakpont_label in breakpoints)
{
var bp_arr = breakpoints[breakpont_label],
min = bp_arr[0],
max = bp_arr[1];
if(max == -1)
max = width;
if(min <= width && max >= width)
{
return breakpont_label;
}
}
return null;
}
// Check current screen breakpoint
function is(screen_label)
{
return get_current_breakpoint() == screen_label;
}
// Is xs device
function isxs()
{
return is('devicescreen') || is('sdevicescreen');
}
// Is md or xl
function ismdxl()
{
return is('tabletscreen') || is('largescreen');
}
// Trigger Resizable Function
function trigger_resizable()
{
if(public_vars.lastBreakpoint != get_current_breakpoint())
{
public_vars.lastBreakpoint = get_current_breakpoint();
resizable(public_vars.lastBreakpoint);
}
// Trigger Event (Repeated)
jQuery(window).trigger('xenon.resized');
}