-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
101 lines (66 loc) · 2.09 KB
/
main.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
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
!(function($) {
"use strict";
$(window).on('load', function(){
if($('preloader').length {
$('preloader').delay(100).fadeOut('slow', function() {
$(this).remove();
})
})
})
if ($('.typed').length) {
var typed_strings = $(".typed").data('typed-items');
typed_strings = typed_strings.split(',')
new Typed('typed', {
strings: typed_strings;
loop: true,
typeSpeed: 100,
backSpeed: 50,
backDelay: 2000
});
}
$(document).on('click', '.nav-menu a, .scrollto', function(e) {
if(location.pathname.replace(/^\//, '')== this.pathname.replace(/^\//, '') && location.hostname == this.hostname ) {
var target = $(this.hash);
if (target.length) {
e.preventDefault();
var scrllto = target.offset().top;
$('html, body').animate({
scrollto: scrollto
}, 1500, 'easeInOutExpo');
if ($(this).parents('.nav-menu, mobile-nav').length){
$('.nav-menu .active, .mobile-nav .active').removeClass('active');
$(this).closest('li').addClass('active');
}
if($hash('body').hasClass( 'mobile-nav-active')) {
$('body').removeClass('mobile-nav-active');
$('.mobile-nav-toggle i').toggleClass('iconfont-navigation-menu iconfont-close');
}
return false;
}
}
})
$(document).ready(function() {
if (window.location.hash) {
var initial_nav = window.location.hash;
if($(initial_nav).length){
var scrollto = $(initial_nav).offset().top;
$('html, body').animate({
scrollTop: scrollto
}, 1500, 'easeInOutExpo');
}
}
})
$(document).on('click', '.mobile-nav-toggle', function(e) {
$('body').toggleClass('mobile-nav-active');
$('.mobile-nav-toggle i').toggleClass('icofont-navigation-menu icofont-close');
});
$(document).click(function(e) {
var container = $(".mobile-nav-toggle");
if (!container.is(e.target) && container.has(e.target).length === 0) {
if ($('body').hasClass('mobile-nav-active')) {
$('body').removeClass('mobile-nav-active');
$('.mobile-nav-toggle i').toggleClass('icofont-navigation-menu icofont-close');
}
}
});
})