/home/moonrcjl/template.moontelict.com/sass-agency/assets/js/script.js
/*-----------------------------------------------------------------
Template Name: Alaxfy - CRM Saas Online Payments HTML5 Template - Sass Agency.
Author: MOONTEL-ICT
Support: https://themeforest.net/user/moontel-ict
Description: Alaxfy - CRM Saas Online Payments HTML5 Template - Sass Agency.
Version: 1.0
-------------------------------------------------------------------
CSS TABLE OF CONTENTS
-------------------------------------------------------------------
01. Swiper Activation
02. According Box
03. Search Popup
04. Video Popup
05. Header Sticky
06. Top To Scroll
07. Mobile Menu Activation
08. Inline Css Activation
09. Wow Activation
10. Custom Cursor Animation
11. Preloader
------------------------------------------------------------------*/
(function ($, window) {
"use strict";
var mtJs = {
m: function () {
mtJs.d();
mtJs.methods();
},
d: function () {
this._window = $(window);
this._document = $(document);
this._body = $("body");
this._html = $("html");
},
methods: function () {
this.inlineCssActivation();
this.mobileMenuActivation();
this.wowActivation();
this.headerSticky();
this.swiperActivation();
this.cursorAnimate();
this.videoPopup();
this.accordingBox();
this.topToScroll();
this.searchPopup();
},
// Start Swiper Activation
swiperActivation: function () {
// Start Brand Logo Slider Home 1
$(document).ready(function () {
var swiper = new Swiper(".mt__brand-logo-items", {
slidesPerView: 6,
breakpoints: {
1521: {
slidesPerView: 6,
},
1200: {
slidesPerView: 5,
},
1199: {
slidesPerView: 4,
},
991: {
slidesPerView: 4,
},
900: {
slidesPerView: 4,
},
899: {
slidesPerView: 3,
},
700: {
slidesPerView: 3,
},
699: {
slidesPerView: 2,
},
445: {
slidesPerView: 2,
},
444: {
slidesPerView: 1,
},
0: {
slidesPerView: 1
},
},
});
});
// End Brand Logo Slider Home 1
// Start Brand Logo Slider Home 1
$(document).ready(function () {
var swiper = new Swiper(".mt__brand-area-item-home-3", {
slidesPerView: 6,
loop: true,
breakpoints: {
1521: {
slidesPerView: 6,
},
1200: {
slidesPerView: 5,
},
1199: {
slidesPerView: 4,
},
991: {
slidesPerView: 4,
spaceBetween: 15,
},
900: {
slidesPerView: 4,
spaceBetween: 15,
},
899: {
slidesPerView: 3,
spaceBetween: 15,
},
700: {
slidesPerView: 3,
spaceBetween: 15,
},
699: {
slidesPerView: 2,
spaceBetween: 15,
},
445: {
slidesPerView: 2,
spaceBetween: 15,
},
444: {
slidesPerView: 2,
spaceBetween: 15,
},
359: {
slidesPerView: 1,
spaceBetween: 15,
},
0: {
slidesPerView: 1,
spaceBetween: 15,
},
},
});
});
// End Brand Logo Slider Home 1
// Start Testimonial Area Home 1
$(document).ready(function () {
var swiper = new Swiper(".mt__testimonial-items", {
slidesPerView: 4.8,
spaceBetween: 24,
slidesPerGroup: 1,
centeredSlides: true,
centeredSlides: true,
loop: true,
autoplay: {
delay: 9000,
},
breakpoints: {
1500: {
slidesPerView: 3,
},
1199: {
slidesPerView: 2,
},
991: {
slidesPerView: 2,
},
767: {
slidesPerView: 1,
spaceBetween: 30,
},
575: {
slidesPerView: 1,
},
0: {
slidesPerView: 1,
}
},
navigation: {
nextEl: ".mt__home-1-testimonial-prev-arrow",
prevEl: ".mt__home-1-testimonial-next-arrow",
},
});
});
// End Testimonial Area Home 1
// Start Testimonial Area Home 2
$(document).ready(function () {
var interleaveOffset = 0.5;
var swiper = new Swiper(".mt__testimonial-home-2", {
slidesPerView: 2,
spaceBetween: 24,
loop: true,
autoplay: {
delay: 9000,
},
breakpoints: {
768: {
slidesPerView: 2,
},
767: {
slidesPerView: 1,
},
0: {
slidesPerView: 1,
}
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
});
});
// End Testimonial Area Home 2
// Start Feature Area Home 3
$(document).ready(function () {
var interleaveOffset = 0.5;
var swiper = new Swiper(".mt__features-area-home-items-home-3", {
slidesPerView: 4,
spaceBetween: 44,
loop: true,
autoplay: {
delay: 9000,
},
breakpoints: {
1921: {
spaceBetween: 44,
},
1920: {
spaceBetween: 24,
},
1300: {
slidesPerView: 4,
spaceBetween: 24,
},
1299: {
slidesPerView: 3,
spaceBetween: 24,
},
951: {
slidesPerView: 3,
spaceBetween: 24,
},
950: {
slidesPerView: 2,
spaceBetween: 24,
},
686: {
slidesPerView: 2,
spaceBetween: 24,
},
685: {
slidesPerView: 1,
},
0: {
slidesPerView: 1,
}
},
navigation: {
nextEl: ".mt__prev-features",
prevEl: ".mt__next-features",
},
pagination: {
el: ".swiper-pagination-features",
clickable: true,
},
});
});
// End Feature Area Home 3
// Start Testimonial Area Home 3
$(document).ready(function () {
var swiper = new Swiper(".mt__testimonials-home-3", {
slidesPreview: 1,
loop: true,
autoplay: {
delay: 3000,
},
navigation: {
nextEl: ".mt__prev-testimonials",
prevEl: ".mt__next-testimonials",
},
});
});
// End Testimonial Area Home 3
},
// End Swiper Activation
// Start According Box
accordingBox: function () {
// Start Home 2
$(document).ready(function () {
$('.accordion-header').click(function () {
const $item = $(this).parent();
// Close all other accordion items
$('.accordion-item').not($item).removeClass('active');
// Toggle the clicked item
$item.toggleClass('active');
});
});
// End Home 2
$(document).ready(function () {
// Accordion functionality
$('.section-title').click(function () {
const content = $(this).next('.section-content');
const arrow = $(this).find('.arrow');
// Close all other sections
$('.section-content').not(content).slideUp();
$('.arrow').not(arrow).removeClass('up');
// Toggle current section
content.slideToggle();
arrow.toggleClass('up');
});
// Read More functionality
$('.read-more').click(function () {
const extraContent = $(this).siblings('.extra-content');
extraContent.slideToggle();
// Toggle button text
$(this).text(function (i, text) {
return text === "Read More +" ? "Read Less -" : "Read More +";
});
});
});
// Start Home 3
// End Home 3
},
// End According Box
// Start Search Popup
searchPopup: function () {
$(document).ready(function () {
$(".mt__search").on("click", function () {
$(".mt__search-bar").addClass("mt__active").fadeIn();
});
$(".mt__search-popup-close").on("click", function () {
$(".mt__search-bar").removeClass("mt__active").fadeOut();
});
});
},
// End Search Popup
// Start Video Popup
videoPopup: function () {
$(document).ready(function () {
$('.mt__popup-video').magnificPopup({
type: 'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
preloader: false,
fixedContentPos: false
});
});
},
// End Video Popup
// Start Header Sticky
headerSticky: function () {
$(document).ready(function () {
$(window).on("scroll", function () {
var ScrollBarPostion = $(window).scrollTop();
if (ScrollBarPostion > 100) {
$(".mt__header-area-home-01, .mt__header-area-home-02, .mt__header-home-3").addClass("mt__header-sticky");
} else {
$(".mt__header-area-home-01, .mt__header-area-home-02, .mt__header-home-3").removeClass("mt__header-sticky");
}
})
})
},
// End Header Sticky
// Start Top To Scroll
topToScroll: function () {
$(document).ready(function () {
var scrollPath = document.querySelector(".scroll-up path");
var pathLength = scrollPath.getTotalLength();
scrollPath.style.transition = scrollPath.style.WebkitTransition = "none";
scrollPath.style.strokeDasharray = pathLength + " " + pathLength;
scrollPath.style.strokeDashoffset = pathLength;
scrollPath.getBoundingClientRect();
scrollPath.style.transition = scrollPath.style.WebkitTransition =
"stroke-dashoffset 10ms linear";
var updatescroll = function () {
var scroll = $(window).scrollTop();
var height = $(document).height() - $(window).height();
var scroll = pathLength - (scroll * pathLength) / height;
scrollPath.style.strokeDashoffset = scroll;
};
updatescroll();
$(window).scroll(updatescroll);
var offset = 50;
var duration = 950;
jQuery(window).on("scroll", function () {
if (jQuery(this).scrollTop() > offset) {
jQuery(".scroll-up").addClass("active-scroll");
} else {
jQuery(".scroll-up").removeClass("active-scroll");
}
});
jQuery(".scroll-up").on("click", function (event) {
event.preventDefault();
jQuery("html, body").animate(
{
scrollTop: 0,
},
duration
);
return false;
});
});
},
// End Top To Scroll
// Start Mobile Menu Activation
mobileMenuActivation: function () {
$(document).ready(function () {
$('.mt__header-mobile-bar').click(function (e) {
var rect = e.target.getBoundingClientRect();
var x = e.clientX - rect.left;
var y = e.clientY - rect.top;
$('.mt__overlay').css({
'--x': x + 'px',
'--y': y + 'px'
}).addClass('mt__animating');
setTimeout(function () {
$('.mt__mobile-menu, .mt__overlay').addClass('mt__active');
animateNavItems();
}, 50);
setTimeout(function () {
$('.mt__overlay').removeClass('mt__animating');
}, 500);
});
$('.mt__close-btn, .mt__overlay').click(function () {
$('.mt__mobile-menu, .mt__overlay').removeClass('mt__active');
});
$('.mt__toggle-btn').click(function (e) {
e.preventDefault();
// Close all other submenus
$('.mt__submenu').not($(this).closest('.mt__nav-item').find('.mt__submenu')).slideUp().removeClass('mt__active');
$('.mt__toggle-btn').not(this).removeClass('mt__active');
// Toggle current submenu
$(this).toggleClass('mt__active');
var $submenu = $(this).closest('.mt__nav-item').find('.mt__submenu');
$submenu.slideToggle(function () {
if ($submenu.is(':visible')) {
$submenu.addClass('mt__active');
animateSubmenuItems($submenu);
} else {
$submenu.removeClass('mt__active');
}
});
});
function animateNavItems() {
$('.mt__nav-item').each(function (index) {
$(this).css({
'animation': `fadeInRight 0.3s ease forwards ${index * 0.1}s`,
'opacity': '0'
});
});
}
function animateSubmenuItems($submenu) {
$submenu.find('.mt__submenu-item').each(function (index) {
$(this).css({
'animation': `fadeInDown 0.3s ease forwards ${index * 0.1}s`,
'opacity': '0'
});
});
}
});
},
// End Mobile Menu Activation
// Start Inline Css Activation
inlineCssActivation: function () {
$(document).ready(function () {
$("[data-background]").each(function () {
$(this).css(
"background-image",
"url( " + $(this).attr("data-background") + " )"
);
});
});
},
// End Inline Css Activation
// Start Wow Activation
wowActivation: function () {
$(document).ready(function () {
new WOW().init();
});
},
// End Wow Activation
// Start Custom Cursor Animation
cursorAnimate: function () {
var myCursor = $('.mouse-cursor');
if (myCursor.length) {
if ($('body')) {
const e = document.querySelector('.cursor-inner'),
t = document.querySelector('.cursor-outer');
let n, i = 0,
o = !1;
window.onmousemove = function (s) {
o || (t.style.transform = "translate(" + s.clientX + "px, " + s.clientY + "px)"), e.style.transform = "translate(" + s.clientX + "px, " + s.clientY + "px)", n = s.clientY, i = s.clientX
}, $('body').on("mouseenter", "a, .cursor-pointer", function () {
e.classList.add('cursor-hover'), t.classList.add('cursor-hover')
}), $('body').on("mouseleave", "a, .cursor-pointer", function () {
$(this).is("a") && $(this).closest(".cursor-pointer").length || (e.classList.remove('cursor-hover'), t.classList.remove('cursor-hover'))
}), e.style.visibility = "visible", t.style.visibility = "visible"
}
}
},
// End Custom Cursor Animation
};
// Start Preloader
function loader() {
$(window).on('load', function() {
// Animate loader off screen
$(".preloader").addClass('loaded');
$(".preloader").delay(600).fadeOut();
});
}
loader();
// End Preloader
window.addEventListener("contextmenu", (function (e) {
e.preventDefault()
}
), !1),
mtJs.m();
})(jQuery, window);