(function ($) {
"user strict";
$(window).on('load', function () {
$('.preloader').fadeOut(1000);
var img = $('.bg_img');
img.css('background-image', function () {
var bg = ('url(' + $(this).data('background') + ')');
return bg;
});
});
$("ul>li>.submenu").parent("li").addClass("menu-item-has-children");
// drop down menu width overflow problem fix
$('ul').parent('li').hover(function () {
var menu = $(this).find("ul");
var menupos = $(menu).offset();
if (menupos.left + menu.width() > $(window).width()) {
var newpos = -$(menu).width();
menu.css({
left: newpos
});
}
});
$("body").each(function () {
$(this).find(".popup-image").magnificPopup({
type: "image",
gallery: {
enabled: true
}
});
});
//Video Popup Youtube
$('.popup-youtube').magnificPopup({
disableOn: 700,
type: 'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
preloader: false,
fixedContentPos: true,
disableOn: 300
});
//Popup Uploaded
$('.popup-player').magnificPopup({
type: 'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
preloader: false,
fixedContentPos: true,
iframe: {
markup: '
',
srcAction: 'iframe_src',
}
});
$('.menu li a').on('click', function (e) {
var element = $(this).parent('li');
if (element.hasClass('open')) {
element.removeClass('open');
element.find('li').removeClass('open');
element.find('ul').slideUp(300, "swing");
} else {
element.addClass('open');
element.children('ul').slideDown(300, "swing");
element.siblings('li').children('ul').slideUp(300, "swing");
element.siblings('li').removeClass('open');
element.siblings('li').find('li').removeClass('open');
element.siblings('li').find('ul').slideUp(300, "swing");
}
})
// Scroll To Top
var scrollTop = $(".scrollToTop");
$(window).on('scroll', function () {
if ($(this).scrollTop() < 500) {
scrollTop.removeClass("active");
} else {
scrollTop.addClass("active");
}
});
//header
var header = $("header");
$(window).on('scroll', function () {
if ($(this).scrollTop() < 220) {
header.removeClass("active");
} else {
header.addClass("active");
}
});
//Click event to scroll to top
$('.scrollToTop').on('click', function () {
$('html, body').animate({
scrollTop: 0
}, 500);
return false;
});
//Header Bar
$('.header-bar').on('click', function () {
$(this).toggleClass('active');
$('.overlay').toggleClass('active');
$('.menu').toggleClass('active');
})
$('.overlay').on('click', function () {
$('.header-bar').removeClass('active');
$('.overlay, .dashboard-menu').removeClass('active');
$('.menu').removeClass('active');
});
$('.faq__wrapper .faq__title').on('click', function (e) {
var element = $(this).parent('.faq__item');
if (element.hasClass('open')) {
element.removeClass('open');
element.find('.faq__content').removeClass('open');
element.find('.faq__content').slideUp(200, "swing");
} else {
element.addClass('open');
element.children('.faq__content').slideDown(200, "swing");
element.siblings('.faq__item').children('.faq__content').slideUp(200, "swing");
element.siblings('.faq__item').removeClass('open');
element.siblings('.faq__item').find('.faq__title').removeClass('open');
element.siblings('.faq__item').find('.faq__content').slideUp(200, "swing");
}
});
$('.client-slider').owlCarousel({
loop: true,
responsiveClass: true,
nav: false,
dots: true,
autoplay: true,
autoplayTimeout: 2500,
autoplayHoverPause: true,
items: 1
});
$('.recent__logins').owlCarousel({
loop: false,
responsiveClass: true,
nav: false,
dots: true,
autoplay: true,
autoplayTimeout: 2500,
autoplayHoverPause: true,
responsive: {
0: {
items: 2,
},
500: {
items: 2,
},
768: {
items: 3,
},
992: {
items: 2,
},
1200: {
items: 3,
},
}
});
$('.sponsor-slider').owlCarousel({
loop: true,
nav: false,
dots: true,
items: 2,
autoplay: true,
margin: 30,
responsive: {
400: {
items: 3
},
767: {
items: 4
},
992: {
items: 4
},
1200: {
items: 6
},
}
})
$('.owl-prev').html('');
$('.owl-next').html('');
$('.type-change').on('click', function(e){
if($(this).hasClass('active')) {
$(this).removeClass('active');
$(this).siblings('input').attr({type:"password"});
$(this).closest('.position-relative').find('.type-change').html('');
}else {
$(this).addClass('active');
$(this).siblings('input').attr({type:"text"});
$(this).closest('.position-relative').find('.type-change').html('');
}
})
$('#check-yearly').on('click', function() {
if($(this).prop("checked") == true) {
$('.tab-contents').children(':last-child').show();
$('.tab-contents').children(':first-child').hide();
}
else if($(this).prop("checked") == false) {
$('.tab-contents').children(':last-child').hide();
$('.tab-contents').children(':first-child').show();
}
});
function copy() {
var copyText = $("#copyUrl input");
copyText.select();
document.execCommand("copy");
}
$("#copyUrl").on("click", copy);
$('.dashboard-menu-open').on('click', function() {
$('.dashboard-menu, .overlay').addClass('active')
})
$('.side-sidebar-close-btn').on('click', function() {
$('.dashboard-menu, .overlay').removeClass('active')
})
if($('.about-section').prev('*').hasClass('hero-section')) {
$('.about-section').removeClass('pt-60');
$('.about-section').addClass('pt-120');
}
Array.from(document.querySelectorAll('table')).forEach(table => {
let heading = table.querySelectorAll('thead tr th');
Array.from(table.querySelectorAll('tbody tr')).forEach((row) => {
if(Array.from(row.querySelectorAll('td')).length > 1){
Array.from(row.querySelectorAll('td')).forEach((colum, i) => {
colum.setAttribute('data-label', heading[i].innerText)
});
}
});
});
})(jQuery);