-
Notifications
You must be signed in to change notification settings - Fork 0
/
menus.js
41 lines (34 loc) · 1.02 KB
/
menus.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 () {
$('.resizable').resizable({
handles: "e"
});
$('.carousel').slick({
infinite: true,
slidesToShow: 4,
slidesToScroll: 2,
vertical: true,
verticalSwiping: true,
swipeToSlide: true
});
var isExpanded = true;
$('.resizable').each(function () {
$(this).resize(function (event) {
if ($(this).width() <= 550) {
switchMode(false, event.target.id);
} else {
switchMode(true, event.target.id);
}
})
})
function switchMode(mode, id) {
if (mode && !isExpanded) {
$(`#trigger-small-${id.charAt(id.length -1)}`).attr('media', '(max-width: 550px)');
isExpanded = true;
console.log("expanded mode " + id)
} else if (!mode && isExpanded) {
$(`#trigger-small-${id.charAt(id.length -1)}`).attr('media', 'all');
isExpanded = false;
console.log("mobile mode " + id)
}
}
})