custom.js
5.45 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
/**
* Template Name: Eventoz
* Version: 1.0
* Template Scripts
* Author: MarkUps
* Author URI: http://www.markups.io/
Custom JS
1. FIXED MENU
2. EVENT TIME COUNTER
3. MENU SMOOTH SCROLLING
4. VIDEO POPUP
5. SPEAKERS SLIDEER ( SLICK SLIDER )
6. BOOTSTRAP ACCORDION
7. MOBILE MENU CLOSE
**/
(function( $ ){
/* ----------------------------------------------------------- */
/* 1. FIXED MENU
/* ----------------------------------------------------------- */
jQuery(window).bind('scroll', function () {
if ($(window).scrollTop() > 150) {
$('.mu-navbar').addClass('mu-nav-show');
} else {
$('.mu-navbar').removeClass('mu-nav-show');
}
});
/* ----------------------------------------------------------- */
/* 2. EVENT TIME COUNTER
/* ----------------------------------------------------------- */
$('#mu-event-counter').countdown('2020/02/10').on('update.countdown', function(event) {
var $this = $(this).html(event.strftime(''
+ '<span class="mu-event-counter-block"><span>%D</span> Days</span> '
+ '<span class="mu-event-counter-block"><span>%H</span> Hours</span> '
+ '<span class="mu-event-counter-block"><span>%M</span> Mins</span> '
+ '<span class="mu-event-counter-block"><span>%S</span> Secs</span>'));
});
/* ----------------------------------------------------------- */
/* 3. MENU SMOOTH SCROLLING
/* ----------------------------------------------------------- */
//MENU SCROLLING WITH ACTIVE ITEM SELECTED
// Cache selectors
var lastId,
topMenu = $(".mu-menu"),
topMenuHeight = topMenu.outerHeight()+13,
// All list items
menuItems = topMenu.find('a[href^=\\#]'),
// Anchors corresponding to menu items
scrollItems = menuItems.map(function(){
var item = $($(this).attr("href"));
if (item.length) { return item; }
});
// Bind click handler to menu items
// so we can get a fancy scroll animation
menuItems.click(function(e){
var href = $(this).attr("href"),
offsetTop = href === "#" ? 0 : $(href).offset().top-topMenuHeight+22;
jQuery('html, body').stop().animate({
scrollTop: offsetTop
}, 1500);
e.preventDefault();
});
// Bind to scroll
jQuery(window).scroll(function(){
// Get container scroll position
var fromTop = $(this).scrollTop()+topMenuHeight;
// Get id of current scroll item
var cur = scrollItems.map(function(){
if ($(this).offset().top < fromTop)
return this;
});
// Get the id of the current element
cur = cur[cur.length-1];
var id = cur && cur.length ? cur[0].id : "";
if (lastId !== id) {
lastId = id;
// Set/remove active class
menuItems
.parent().removeClass("active")
.end().filter("[href=\\#"+id+"]").parent().addClass("active");
}
})
/* ----------------------------------------------------------- */
/* 4. VIDEO POPUP
/* ----------------------------------------------------------- */
$('.mu-video-play-btn').on('click', function(event) {
event.preventDefault();
$('.mu-video-iframe-area').addClass('mu-video-iframe-display');
});
// when click the close btn
// disappear iframe window
$('.mu-video-close-btn').on('click', function(event) {
event.preventDefault();
$('.mu-video-iframe-area').removeClass('mu-video-iframe-display');
});
// stop iframe if it is play while close the iframe window
$('.mu-video-close-btn').click(function(){
$('.mu-video-iframe').attr('src', $('.mu-video-iframe').attr('src'));
});
// when click overlay area
$('.mu-video-iframe-area').on('click', function(event) {
event.preventDefault();
$('.mu-video-iframe-area').removeClass('mu-video-iframe-display');
});
$('.mu-video-iframe-area, .mu-video-iframe').on('click', function(e){
e.stopPropagation();
});
/* ----------------------------------------------------------- */
/* 5. SPEAKERS SLIDEER ( SLICK SLIDER )
/* ----------------------------------------------------------- */
$('.mu-speakers-slider').slick({
slidesToShow: 4,
responsive: [
{
breakpoint: 768,
settings: {
arrows: true,
slidesToShow: 3
}
},
{
breakpoint: 480,
settings: {
arrows: true,
slidesToShow: 1
}
}
]
});
/* ----------------------------------------------------------- */
/* 6. BOOTSTRAP ACCORDION
/* ----------------------------------------------------------- */
/* Start for accordion #1*/
$('#accordion .panel-collapse').on('shown.bs.collapse', function () {
$(this).prev().find(".fa").removeClass("fa-angle-up").addClass("fa-angle-down");
});
//The reverse of the above on hidden event:
$('#accordion .panel-collapse').on('hidden.bs.collapse', function () {
$(this).prev().find(".fa").removeClass("fa-angle-down").addClass("fa-angle-up");
});
/* ----------------------------------------------------------- */
/* 7. MOBILE MENU CLOSE
/* ----------------------------------------------------------- */
jQuery('.mu-menu').on('click', 'li a', function() {
$('.mu-navbar .in').collapse('hide');
});
})( jQuery );