/*
Template: Xcloud - Cloud Gaming HTML Template
Author: peacefulqode.com
Version: 1.0
Design and Developed by: PeacefulQode
*/
/*================================================
[ Table of contents ]
==================================================
==> Page Loader
==> Accordion
==> Sticky Header
==> Owl Carousel
==> Back To Top
==> WOW
==> Video Popup
==> Image Gallery
==> Portfolio Tab
==> Image Slide Selector
==> Video Player
==================================================
[ End table content ]
================================================*/
(function (jQuery) {
"use strict";
jQuery(window).on('load', function (e) {
/*==================================================
[ Page Loader ]
==================================================*/
jQuery("#pq-loading").fadeOut();
jQuery("#pq-loading").delay(0).fadeOut("slow");
var Scrollbar = window.Scrollbar;
/*==================================================
[ Accordion ]
==================================================*/
jQuery('.pq-accordion-block .pq-accordion-box .pq-accordion-details').hide();
jQuery('.pq-accordion-block .pq-accordion-box:first').addClass('pq-active').children().slideDown('slow');
jQuery('.pq-accordion-block .pq-accordion-box').on("click", function () {
if (jQuery(this).children('div.pq-accordion-details').is(':hidden')) {
jQuery('.pq-accordion-block .pq-accordion-box').removeClass('pq-active').children('div.pq-accordion-details').slideUp('slow');
jQuery(this).toggleClass('pq-active').children('div.pq-accordion-details').slideDown('slow');
}
});
/*==================================================
[ Sticky Header ]
==================================================*/
var view_width = jQuery(window).width();
if (!jQuery('header').hasClass('pq-header-default') && view_width >= 1023) {
var height = jQuery('header').height();
jQuery('.pq-breadcrumb').css('padding-top', height * 1.3);
}
if (jQuery('header').hasClass('pq-header-default')) {
jQuery(window).scroll(function () {
var scrollTop = jQuery(window).scrollTop();
if (scrollTop > 300) {
jQuery('.pq-bottom-header').addClass('pq-header-sticky animated fadeInDown animate__faster');
} else {
jQuery('.pq-bottom-header').removeClass('pq-header-sticky animated fadeInDown animate__faster');
}
});
}
if (jQuery('header').hasClass('pq-has-sticky')) {
jQuery(window).scroll(function () {
var scrollTop = jQuery(window).scrollTop();
if (scrollTop > 300) {
jQuery('.pq-bottom-header').addClass('pq-header-sticky animated fadeInDown animate__faster');
} else {
jQuery('.pq-bottom-header').removeClass('pq-header-sticky animated fadeInDown animate__faster');
}
});
}
/*==================================================
[ Owl Carousel ]
==================================================*/
jQuery('.owl-carousel').each(function () {
var app_slider = jQuery(this);
app_slider.owlCarousel({
items: app_slider.data("desk_num"),
loop: app_slider.data("loop"),
margin: app_slider.data("margin"),
nav: app_slider.data("nav"),
dots: app_slider.data("dots"),
autoplay: app_slider.data("autoplay"),
autoplayTimeout: app_slider.data("autoplay-timeout"),
navText: ["", ""],
responsiveClass: true,
responsive: {
// breakpoint from 0 up
0: {
items: app_slider.data("mob_sm"),
nav: false
},
// breakpoint from 480 up
480: {
items: app_slider.data("mob_num"),
nav: false
},
// breakpoint from 786 up
786: {
items: app_slider.data("tab_num")
},
// breakpoint from 1023 up
1024: {
items: app_slider.data("lap_num")
},
1199: {
items: app_slider.data("desk_num")
}
}
});
});
});
/*==================================================
[ Back To Top ]
==================================================*/
jQuery('#back-to-top').fadeOut();
jQuery(window).on("scroll", function () {
if (jQuery(this).scrollTop() > 250) {
jQuery('#back-to-top').fadeIn(1400);
} else {
jQuery('#back-to-top').fadeOut(400);
}
});
jQuery('#top').on('click', function () {
jQuery('top').tooltip('hide');
jQuery('body,html').animate({
scrollTop: 0
}, 800);
return false;
});
/*==================================================
[ wow ]
==================================================*/
new WOW().init();
/*==================================================
[ Video Popup ]
==================================================*/
jQuery(document).ready(function () {
jQuery('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
disableOn: 700,
type: 'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
preloader: false,
fixedContentPos: false
});
});
/*==================================================
[ Image Gallery ]
==================================================*/
jQuery('.gallery').each(function () { // the containers for all your galleries
jQuery(this).magnificPopup({
delegate: 'a', // the selector for gallery item
type: 'image',
gallery: {
enabled: true
}
});
});
/*==================================================
[ Portfolio Tab ]
==================================================*/
jQuery('.pq-menu-tabs .menu-tabs-item:first-child').addClass("active");
jQuery('.pq-menu-tabs .menu-tabs-item').on({
mouseenter: function () {
jQuery('.pq-menu-tabs .menu-tabs-item').removeClass('active');
jQuery(this).addClass('active');
},
});
/*==================================================
[ Image Slide Selector ]
==================================================*/
jQuery('.pq-background-img-item:first-child').addClass("active");
jQuery(".pq-background-img-item").click(function () {
jQuery('.pq-background-img-item').removeClass("active");
jQuery(this).addClass("active");
});
/*==================================================
[ Video Player ]
==================================================*/
jQuery(".pq-gaming-video").hover(
function () {
jQuery('video', this).get(0).play();
},
function () {
jQuery('video', this).get(0).pause();
}
);
jQuery(window).on('scroll', function() {
if (jQuery('.pq-gaming-video-box').length > 0) {
jQuery("body").trigger("click");
}
});
})(jQuery);