AOS.init({
duration: 800,
easing: 'slide'
});
(function($) {
"use strict";
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
$(window).stellar({
responsive: true,
parallaxBackgrounds: true,
parallaxElements: true,
horizontalScrolling: false,
hideDistantElements: false,
scrollProperty: 'scroll'
});
var fullHeight = function() {
$('.js-fullheight').css('height', $(window).height());
$(window).resize(function(){
$('.js-fullheight').css('height', $(window).height());
});
};
fullHeight();
// loader
var loader = function() {
setTimeout(function() {
if($('#ftco-loader').length > 0) {
$('#ftco-loader').removeClass('show');
}
}, 1);
};
loader();
// Scrollax
$.Scrollax();
// Burger Menu
var burgerMenu = function() {
$('body').on('click', '.js-fh5co-nav-toggle', function(event){
event.preventDefault();
if ( $('#ftco-nav').is(':visible') ) {
$(this).removeClass('active');
} else {
$(this).addClass('active');
}
});
};
burgerMenu();
// Page Nav
var clickMenu = function() {
$('#ftco-nav a:not([class="external"])').click(function(event){
var section = $(this).data('nav-section'),
navbar = $('#ftco-nav');
if ( $('[data-section="' + section + '"]').length ) {
$('html, body').animate({
scrollTop: $('[data-section="' + section + '"]').offset().top - 70
}, 500);
}
if ( navbar.is(':visible')) {
navbar.removeClass('in');
navbar.attr('aria-expanded', 'false');
$('.js-fh5co-nav-toggle').removeClass('active');
}
event.preventDefault();
return false;
});
};
// clickMenu();
// Reflect scrolling in navigation
var navActive = function(section) {
var $el = $('#ftco-nav > ul');
$el.find('li').removeClass('active');
$el.each(function(){
$(this).find('a[data-nav-section="'+section+'"]').closest('li').addClass('active');
});
};
navActive();
var navigationSection = function() {
var $section = $('section[data-section]');
$section.waypoint(function(direction) {
if (direction === 'down') {
navActive($(this.element).data('section'));
}
}, {
offset: '150px'
});
$section.waypoint(function(direction) {
if (direction === 'up') {
navActive($(this.element).data('section'));
}
}, {
offset: function() { return -$(this.element).height() + 155; }
});
};
navigationSection();
var carousel = function() {
$('.carousel-testimony').owlCarousel({
autoplay: true,
autoHeight: true,
center: true,
loop: true,
items:1,
margin: 30,
stagePadding: 0,
nav: true,
dots: false,
navText: ['', ''],
responsive:{
0:{
items: 1
},
600:{
items: 1
},
1000:{
items: 1
}
}
});
$('.carousel-project').owlCarousel({
autoplay: true,
autoHeight: true,
center: false,
loop: true,
items:1,
margin: 30,
stagePadding: 0,
nav: false,
dots: true,
navText: ['', ''],
responsive:{
0:{
items: 1
},
600:{
items: 2
},
1000:{
items: 4
}
}
});
};
carousel();
$('nav .dropdown').hover(function(){
var $this = $(this);
// timer;
// clearTimeout(timer);
$this.addClass('show');
$this.find('> a').attr('aria-expanded', true);
// $this.find('.dropdown-menu').addClass('animated-fast fadeInUp show');
$this.find('.dropdown-menu').addClass('show');
}, function(){
var $this = $(this);
// timer;
// timer = setTimeout(function(){
$this.removeClass('show');
$this.find('> a').attr('aria-expanded', false);
// $this.find('.dropdown-menu').removeClass('animated-fast fadeInUp show');
$this.find('.dropdown-menu').removeClass('show');
// }, 100);
});
$('#dropdown04').on('show.bs.dropdown', function () {
console.log('show');
});
// scroll
var scrollWindow = function() {
$(window).scroll(function(){
var $w = $(this),
st = $w.scrollTop(),
navbar = $('.ftco_navbar'),
sd = $('.js-scroll-wrap');
if (st > 150) {
if ( !navbar.hasClass('scrolled') ) {
navbar.addClass('scrolled');
}
}
if (st < 150) {
if ( navbar.hasClass('scrolled') ) {
navbar.removeClass('scrolled sleep');
}
}
if ( st > 350 ) {
if ( !navbar.hasClass('awake') ) {
navbar.addClass('awake');
}
if(sd.length > 0) {
sd.addClass('sleep');
}
}
if ( st < 350 ) {
if ( navbar.hasClass('awake') ) {
navbar.removeClass('awake');
navbar.addClass('sleep');
}
if(sd.length > 0) {
sd.removeClass('sleep');
}
}
});
};
scrollWindow();
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
var counter = function() {
$('#section-counter, .hero-wrap, .ftco-counter').waypoint( function( direction ) {
if( direction === 'down' && !$(this.element).hasClass('ftco-animated') ) {
var comma_separator_number_step = $.animateNumber.numberStepFactories.separator(',')
$('.number').each(function(){
var $this = $(this),
num = $this.data('number');
$this.animateNumber(
{
number: num,
numberStep: comma_separator_number_step
}, 7000
);
});
}
} , { offset: '95%' } );
}
counter();
var contentWayPoint = function() {
var i = 0;
$('.ftco-animate').waypoint( function( direction ) {
if( direction === 'down' && !$(this.element).hasClass('ftco-animated') ) {
i++;
$(this.element).addClass('item-animate');
setTimeout(function(){
$('body .ftco-animate.item-animate').each(function(k){
var el = $(this);
setTimeout( function () {
var effect = el.data('animate-effect');
if ( effect === 'fadeIn') {
el.addClass('fadeIn ftco-animated');
} else if ( effect === 'fadeInLeft') {
el.addClass('fadeInLeft ftco-animated');
} else if ( effect === 'fadeInRight') {
el.addClass('fadeInRight ftco-animated');
} else {
el.addClass('fadeInUp ftco-animated');
}
el.removeClass('item-animate');
}, k * 50, 'easeInOutExpo' );
});
}, 100);
}
} , { offset: '95%' } );
};
contentWayPoint();
// magnific popup
$('.image-popup').magnificPopup({
type: 'image',
closeOnContentClick: true,
closeBtnInside: false,
fixedContentPos: true,
mainClass: 'mfp-no-margins mfp-with-zoom', // class to remove default margin from left and right side
gallery: {
enabled: true,
navigateByImgClick: true,
preload: [0,1] // Will preload 0 - before current, and 1 after the current image
},
image: {
verticalFit: true
},
zoom: {
enabled: true,
duration: 300 // don't foget to change the duration also in CSS
}
});
$('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
disableOn: 700,
type: 'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
preloader: false,
fixedContentPos: false
});
// $(function() {
// $('a[href*=#]').on('click', function(e) {
// e.preventDefault();
// $('html, body').animate({ scrollTop: $($(this).attr('href')).offset().top}, 500, 'linear');
// });
// });
$('a[href*=#fragment]').on('click', function(e) {
e.preventDefault();
$('html, body').animate({ scrollTop: $($(this).attr('href')).offset().top}, 500, 'linear');
});
function scrollToSection(event) {
if( $('nav.home').length ){
const section = $($(this).attr('href'));
if(section){
event.preventDefault();
$('html, body').animate({
scrollTop: section.offset().top
}, 500);
}
}else {
if(typeof home_url != 'undefined'){
let section = $(this).attr('href');
const url = home_url.website_url+"/"+section;
location.href = url;
}
}
}
$('[data-scroll]').on('click', scrollToSection);
//gutenburg
const scrollbarWidth = window.innerWidth - document.body.clientWidth;
$('.alignfull').css({
'width': `calc(100vw - ${scrollbarWidth}px)`,
'max-width': `calc(100vw - ${scrollbarWidth}px)`,
'margin': `0 calc(-50vw + 50% + ${scrollbarWidth / 2}px)`
});
})
(jQuery);