AC_services_website_design/public/assets/js/main.js

472 lines
9.1 KiB
JavaScript

(function ($) {
"use strict";
//preloader activation
var win = $(window);
win.on('load', function () {
$('#preloader').delay(350).fadeOut('slow');
$('body').delay(350).css({
'overflow': 'visible'
});
})
// meanmenu
$('#mobile-menu').meanmenu({
meanMenuContainer: '.mobile-menu',
meanScreenWidth: "991"
});
//mobile side menu
$('.side-toggle').on('click', function () {
$('.side-info').addClass('info-open');
$('.offcanvas-overlay').addClass('overlay-open');
})
$('.side-info-close,.offcanvas-overlay').on('click', function () {
$('.side-info').removeClass('info-open');
$('.offcanvas-overlay').removeClass('overlay-open');
})
//sticky menu activation
win.on('scroll', function () {
var scroll = win.scrollTop();
if (scroll < 60) {
$(".header-sticky").removeClass("sticky-menu");
} else {
$(".header-sticky").addClass("sticky-menu");
}
});
// data - background
$("[data-background]").each(function () {
$(this).css("background-image", "url(" + $(this).attr("data-background") + ")")
})
$("[data-bg-color]").each(function () {
$(this).css("background-color", $(this).attr("data-bg-color"))
})
// isotop activation
$('.portfolio-area').imagesLoaded( function() {
// init Isotope
var $grid = $('.aportfolio-active').isotope({
itemSelector: '.grid-item',
percentPosition: true,
masonry: {
// use outer width of grid-sizer for columnWidth
columnWidth: 1,
}
});
// filter items on button click
$('.aportfolio-menu').on( 'click', 'button', function() {
var filterValue = $(this).attr('data-filter');
$grid.isotope({ filter: filterValue });
});
});
//for menu active class
$('.aportfolio-menu button').on('click', function(event) {
$(this).siblings('.active').removeClass('active');
$(this).addClass('active');
event.preventDefault();
});
//venobox activation
$('.venobox').venobox();
// Scroll To Top Js
function smoothSctollTop() {
$('.smooth-scroll a').on('click', function (event) {
var target = $(this.getAttribute('href'));
if (target.length) {
event.preventDefault();
$('html, body').stop().animate({
scrollTop: target.offset().top - 0
}, 1500);
}
});
}
smoothSctollTop();
// Show or hide the sticky footer button
win.on('scroll', function(event) {
if($(this).scrollTop() > 600){
$('#scroll').fadeIn(200)
} else{
$('#scroll').fadeOut(200)
}
});
//Animate the scroll to yop
$('#scroll').on('click', function(event) {
event.preventDefault();
$('html, body').animate({
scrollTop: 0,
}, 1500);
});
// WOW active
var wow = new WOW(
{
mobile: false, // trigger animations on mobile devices (default is true)
}
);
wow.init();
/*------------------------------------
Slider
--------------------------------------*/
if (jQuery(".slider-active").length > 0) {
let sliderActive1 = '.slider-active';
let sliderInit1 = new Swiper(sliderActive1, {
// Optional parameters
slidesPerView: 1,
slidesPerColumn: 1,
paginationClickable: true,
loop: false,
effect: 'fade',
autoplay: {
delay: 5000,
},
// If we need pagination
pagination: {
el: '.swiper-paginations',
// dynamicBullets: true,
clickable: true,
},
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
a11y: false
});
function animated_swiper(selector, init) {
let animated = function animated() {
$(selector + ' [data-animation]').each(function () {
let anim = $(this).data('animation');
let delay = $(this).data('delay');
let duration = $(this).data('duration');
$(this).removeClass('anim' + anim)
.addClass(anim + ' animated')
.css({
webkitAnimationDelay: delay,
animationDelay: delay,
webkitAnimationDuration: duration,
animationDuration: duration
})
.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
$(this).removeClass(anim + ' animated');
});
});
};
animated();
// Make animated when slide change
init.on('slideChange', function () {
$(sliderActive1 + ' [data-animation]').removeClass('animated');
});
init.on('slideChange', animated);
}
animated_swiper(sliderActive1, sliderInit1);
}
// team 3 activation
if (jQuery(".team-active-3").length > 0) {
let swiperteam = new Swiper('.team-active-3', {
slidesPerView: 1,
spaceBetween: 30,
// direction: 'vertical',
loop: true,
infinite: false,
autoplay: {
delay: 5000,
},
// If we need pagination
pagination: {
el: '.swiper-pagination',
clickable: true,
},
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// And if we need scrollbar
scrollbar: {
el: '.swiper-scrollbar',
dynamicBullets: true,
},
breakpoints: {
480: {
slidesPerView: 2,
},
768: {
slidesPerView: 3,
},
1200: {
slidesPerView: 2,
},
1400: {
slidesPerView: 3,
},
}
});
}
// team 3 activation
if (jQuery(".testimonial-active-3").length > 0) {
let swipertest = new Swiper('.testimonial-active-3', {
slidesPerView: 1,
spaceBetween: 30,
// direction: 'vertical',
loop: false,
infinite: false,
// If we need pagination
pagination: {
el: '.swiper-pagination2',
clickable: true,
},
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// And if we need scrollbar
scrollbar: {
el: '.swiper-scrollbar',
dynamicBullets: true,
},
breakpoints: {
480: {
slidesPerView: 1,
},
768: {
slidesPerView: 2,
},
1200: {
slidesPerView: 3,
},
1400: {
slidesPerView: 3,
},
}
});
}
// gallery activation
if (jQuery(".gallery-active").length > 0) {
let gallery = new Swiper('.gallery-active', {
slidesPerView: 1,
spaceBetween: 30,
// direction: 'vertical',
loop: false,
// If we need pagination
pagination: {
el: '.swiper-pagination',
clickable: true,
},
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// And if we need scrollbar
scrollbar: {
el: '.swiper-scrollbar',
dynamicBullets: true,
},
breakpoints: {
480: {
slidesPerView: 2,
},
768: {
slidesPerView: 3,
},
1200: {
slidesPerView: 4,
},
}
});
}
// testimonial 2 activation
if (jQuery(".testimonial-active-2").length > 0) {
let testimonial2 = new Swiper('.testimonial-active-2', {
slidesPerView: 1,
spaceBetween: 30,
// direction: 'vertical',
loop: true,
// If we need pagination
pagination: {
el: '.swiper-pagination',
clickable: true,
},
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// And if we need scrollbar
scrollbar: {
el: '.swiper-scrollbar',
dynamicBullets: true,
},
breakpoints: {
640: {
slidesPerView: 1,
},
768: {
slidesPerView: 1,
},
1024: {
slidesPerView: 1,
},
}
});
}
// blog gallery activation
if (jQuery(".ablog__img--active").length > 0) {
let ablogimgactive = new Swiper('.ablog__img--active', {
slidesPerView: 1,
spaceBetween: 30,
// direction: 'vertical',
loop: true,
// If we need pagination
pagination: {
el: '.swiper-pagination',
clickable: true,
},
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// And if we need scrollbar
scrollbar: {
el: '.swiper-scrollbar',
dynamicBullets: true,
},
breakpoints: {
640: {
slidesPerView: 1,
},
768: {
slidesPerView: 1,
},
1024: {
slidesPerView: 1,
},
}
});
}
// testimonial 1 activation
if (jQuery(".atestimonial-active").length > 0) {
let atestimonial1 = new Swiper('.atestimonial-active', {
slidesPerView: 1,
spaceBetween: 30,
// direction: 'vertical',
loop: true,
// If we need pagination
pagination: {
el: '.swiper-pagination',
clickable: true,
},
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// And if we need scrollbar
scrollbar: {
el: '.swiper-scrollbar',
},
});
}
// brand activation
if (jQuery(".brand-active").length > 0) {
let brand = new Swiper('.brand-active', {
slidesPerView: 2,
spaceBetween: 30,
// direction: 'vertical',
loop: true,
autoplay: {
delay: 5000,
},
// If we need pagination
pagination: {
el: '.swiper-pagination',
clickable: true,
},
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// And if we need scrollbar
scrollbar: {
el: '.swiper-scrollbar',
},
breakpoints: {
550: {
slidesPerView: 3,
},
768: {
slidesPerView: 4,
},
1200: {
slidesPerView: 5,
},
}
});
}
})(jQuery);