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
/**
Core script to handle the entire theme and core functions
**/
var Layout = function() {
var layoutImgPath = 'layouts/layout7/img/';
var layoutCssPath = 'layouts/layout7/css/';
var resBreakpointMd = App.getResponsiveBreakpoint('md'); //992px
var resBreakpointSm = App.getResponsiveBreakpoint('sm'); //768px
// handle go to top button
var handleGo2Top = function () {
var Go2TopOperation = function(){
var CurrentWindowPosition = $(window).scrollTop();// current vertical position
if (CurrentWindowPosition > 100) {
$(".go2top").show();
} else {
$(".go2top").hide();
}
};
Go2TopOperation();// call headerFix() when the page was loaded
if (navigator.userAgent.match(/iPhone|iPad|iPod/i)) {
$(window).bind("touchend touchcancel touchleave", function(e){
Go2TopOperation();
});
} else {
$(window).scroll(function() {
Go2TopOperation();
});
}
$(".go2top").click(function(e) {
e.preventDefault();
$("html, body").animate({ scrollTop: 0 }, 600);
});
};
var handleMenu = function () {
var overlay = $('.menu-bg-overlay');
var close = $('.menu-close');
var trigger = $('.menu-trigger');
var modal = $('.menu-overlay');
trigger.click(function() {
var removeModal = function() {
modal.removeClass('menu-overlay-show');
}
modal.addClass('menu-overlay-show');
overlay.off('click', removeModal);
overlay.on('click', removeModal);
});
close.click(function(e) {
e.stopPropagation();
modal.removeClass('menu-overlay-show');
});
};
return {
// Main init methods to initialize the layout
// IMPORTANT!!!: Do not modify the core handlers call order.
init: function () {
handleGo2Top(); // handle go to top
handleMenu(); // handle menu
},
getLayoutImgPath: function() {
return App.getAssetsPath() + layoutImgPath;
},
getLayoutCssPath: function() {
return App.getAssetsPath() + layoutCssPath;
}
};
}();
jQuery(document).ready(function() {
Layout.init(); // init metronic core componets
});