-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js.téléchargé
234 lines (183 loc) · 4.77 KB
/
main.js.téléchargé
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
(function($) {
"use strict";
$(window).stellar({
responsive: true,
parallaxBackgrounds: true,
parallaxElements: true,
horizontalScrolling: false,
hideDistantElements: false,
scrollProperty: 'scroll'
});
var fullHeight = function() {
$('.js-fullheight').css('height', $(window).height());
$(window).resize(function(){
$('.js-fullheight').css('height', $(window).height());
});
};
fullHeight();
// loader
var loader = function() {
setTimeout(function() {
if($('#ftco-loader').length > 0) {
$('#ftco-loader').removeClass('show');
}
}, 1);
};
loader();
// Scrollax
$.Scrollax();
var burgerMenu = function() {
$('.js-colorlib-nav-toggle').on('click', function(event){
event.preventDefault();
var $this = $(this);
if ($('body').hasClass('offcanvas')) {
$this.removeClass('active');
$('body').removeClass('offcanvas');
} else {
$this.addClass('active');
$('body').addClass('offcanvas');
}
});
};
burgerMenu();
// Click outside of offcanvass
var mobileMenuOutsideClick = function() {
$(document).click(function (e) {
var container = $("#colorlib-aside, .js-colorlib-nav-toggle");
if (!container.is(e.target) && container.has(e.target).length === 0) {
if ( $('body').hasClass('offcanvas') ) {
$('body').removeClass('offcanvas');
$('.js-colorlib-nav-toggle').removeClass('active');
}
}
});
$(window).scroll(function(){
if ( $('body').hasClass('offcanvas') ) {
$('body').removeClass('offcanvas');
$('.js-colorlib-nav-toggle').removeClass('active');
}
});
};
mobileMenuOutsideClick();
var carousel = function() {
$('.home-slider').owlCarousel({
loop:true,
autoplay: true,
margin:0,
animateOut: 'fadeOut',
animateIn: 'fadeIn',
nav:false,
autoplayHoverPause: false,
items: 1,
navText : ["<span class='ion-md-arrow-back'></span>","<span class='ion-chevron-right'></span>"],
responsive:{
0:{
items:1
},
600:{
items:1
},
1000:{
items:1
}
}
});
$('.author-slider').owlCarousel({
autoplay: true,
loop: true,
items:1,
margin: 30,
stagePadding: 0,
nav: true,
dots: true,
navText: ['<span class="ion-ios-arrow-back">', '<span class="ion-ios-arrow-forward">'],
responsive:{
0:{
items: 1
},
600:{
items: 1
},
1000:{
items: 1
}
}
});
};
carousel();
var contentWayPoint = function() {
var i = 0;
$('.ftco-animate').waypoint( function( direction ) {
if( direction === 'down' && !$(this.element).hasClass('ftco-animated') ) {
i++;
$(this.element).addClass('item-animate');
setTimeout(function(){
$('body .ftco-animate.item-animate').each(function(k){
var el = $(this);
setTimeout( function () {
var effect = el.data('animate-effect');
if ( effect === 'fadeIn') {
el.addClass('fadeIn ftco-animated');
} else if ( effect === 'fadeInLeft') {
el.addClass('fadeInLeft ftco-animated');
} else if ( effect === 'fadeInRight') {
el.addClass('fadeInRight ftco-animated');
} else {
el.addClass('fadeInUp ftco-animated');
}
el.removeClass('item-animate');
}, k * 50, 'easeInOutExpo' );
});
}, 100);
}
} , { offset: '95%' } );
};
contentWayPoint();
var counter = function() {
$('#section-counter').waypoint( function( direction ) {
if( direction === 'down' && !$(this.element).hasClass('ftco-animated') ) {
var comma_separator_number_step = $.animateNumber.numberStepFactories.separator(',')
$('.number').each(function(){
var $this = $(this),
num = $this.data('number');
console.log(num);
$this.animateNumber(
{
number: num,
numberStep: comma_separator_number_step
}, 7000
);
});
}
} , { offset: '95%' } );
}
counter();
// magnific popup
$('.image-popup').magnificPopup({
type: 'image',
closeOnContentClick: true,
closeBtnInside: false,
fixedContentPos: true,
// mainClass: 'mfp-no-margins mfp-with-zoom', // class to remove default margin from left and right side
gallery: {
enabled: true,
navigateByImgClick: true,
preload: [0,1] // Will preload 0 - before current, and 1 after the current image
},
image: {
verticalFit: true
},
zoom: {
enabled: true,
duration: 300 // don't foget to change the duration also in CSS
}
});
$('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
disableOn: 700,
type: 'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
preloader: false,
fixedContentPos: false
});
})(jQuery);