Repository navigation
Expand file tree
/
Copy pathmain.js
More file actions
117 lines (105 loc) · 2.83 KB
/
Copy pathmain.js
File metadata and controls
117 lines (105 loc) · 2.83 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
(function ($) {
"use strict";
var nav = $('nav');
var navHeight = nav.outerHeight();
$('.navbar-toggler').on('click', function() {
if( ! $('#mainNav').hasClass('navbar-reduce')) {
$('#mainNav').addClass('navbar-reduce');
}
})
// Preloader
$(window).on('load', function () {
if ($('#preloader').length) {
$('#preloader').delay(100).fadeOut('slow', function () {
$(this).remove();
});
}
});
// Back to top button
$(window).scroll(function() {
if ($(this).scrollTop() > 100) {
$('.back-to-top').fadeIn('slow');
} else {
$('.back-to-top').fadeOut('slow');
}
});
$('.back-to-top').click(function(){
$('html, body').animate({scrollTop : 0},1500, 'easeInOutExpo');
return false;
});
/*--/ Star ScrollTop /--*/
$('.scrolltop-mf').on("click", function () {
$('html, body').animate({
scrollTop: 0
}, 1000);
});
/*--/ Star Counter /--*/
$('.counter').counterUp({
delay: 15,
time: 2000
});
/*--/ Star Scrolling nav /--*/
$('a.js-scroll[href*="#"]:not([href="#"])').on("click", function () {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$('html, body').animate({
scrollTop: (target.offset().top - navHeight + 5)
}, 1000, "easeInOutExpo");
return false;
}
}
});
// Closes responsive menu when a scroll trigger link is clicked
$('.js-scroll').on("click", function () {
$('.navbar-collapse').collapse('hide');
});
// Activate scrollspy to add active class to navbar items on scroll
$('body').scrollspy({
target: '#mainNav',
offset: navHeight
});
/*--/ End Scrolling nav /--*/
/*--/ Navbar Menu Reduce /--*/
$(window).trigger('scroll');
$(window).on('scroll', function () {
var pixels = 50;
var top = 1200;
if ($(window).scrollTop() > pixels) {
$('.navbar-expand-md').addClass('navbar-reduce');
$('.navbar-expand-md').removeClass('navbar-trans');
} else {
$('.navbar-expand-md').addClass('navbar-trans');
$('.navbar-expand-md').removeClass('navbar-reduce');
}
if ($(window).scrollTop() > top) {
$('.scrolltop-mf').fadeIn(1000, "easeInOutExpo");
} else {
$('.scrolltop-mf').fadeOut(1000, "easeInOutExpo");
}
});
/*--/ Star Typed /--*/
if ($('.text-slider').length == 1) {
var typed_strings = $('.text-slider-items').text();
var typed = new Typed('.text-slider', {
strings: typed_strings.split(','),
typeSpeed: 80,
loop: true,
backDelay: 1100,
backSpeed: 30
});
}
/*--/ Testimonials owl /--*/
$('#testimonial-mf').owlCarousel({
margin: 20,
autoplay: true,
autoplayTimeout: 4000,
autoplayHoverPause: true,
responsive: {
0: {
items: 1,
}
}
});
})(jQuery);