( function($) {
'use strict';
/*-------------------------------------------------------------------------------
Detect mobile device
-------------------------------------------------------------------------------*/
var mobileDevice = false;
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
$('html').addClass('mobile');
mobileDevice = true;
}
else{
$('html').addClass('no-mobile');
mobileDevice = false;
}
/*-------------------------------------------------------------------------------
Window load
-------------------------------------------------------------------------------*/
$(window).on('load', function(){
var wow = new WOW({
offset: 150,
mobile: false
}
);
wow.init();
});
/*-------------------------------------------------------------------------------
Loader
-------------------------------------------------------------------------------*/
$(".animsition").animsition({
inClass: 'fade-in',
outClass: 'fade-out',
inDuration: 1000,
outDuration: 700,
linkElement: '.menu-list a',
// e.g. linkElement: 'a:not([target="_blank"]):not([href^="#"])'
loading:true,
loadingParentElement: 'body', //animsition wrapper element
loadingClass: 'spinner',
loadingInner: '
', // e.g '
'
timeout: false,
timeoutCountdown:5000,
onLoadEvent: true,
browser: [ 'animation-duration', '-webkit-animation-duration'],
// "browser" option allows you to disable the "animsition" in case the css property in the array is not supported by your browser.
// The default setting is to disable the "animsition" in a browser that does not support "animation-duration".
overlay : false,
overlayClass : 'animsition-overlay-slide',
overlayParentElement : 'body',
transition: function(url){ window.location.href = url; }
});
/*-------------------------------------------------------------------------------
Smooth scroll to anchor
-------------------------------------------------------------------------------*/
$('.js-target-scroll').on('click', function() {
var target = $(this.hash);
if (target.length) {
$('html,body').animate({
scrollTop: (target.offset().top - navbar.outerHeight())
}, 1000);
return false;
}
});
/*-------------------------------------------------------------------------------
Parallax
-------------------------------------------------------------------------------*/
$(window).stellar({
responsive: true,
horizontalScrolling: false,
hideDistantElements: false,
horizontalOffset: 0,
verticalOffset: 0,
});
/*-------------------------------------------------------------------------------
Full screen sections
-------------------------------------------------------------------------------*/
if ($('.pagepiling').length > 0){
$('.pagepiling').pagepiling({
scrollingSpeed: 280,
loopBottom:true,
afterLoad: function(anchorLink, index){
if(index == 1 || index == 2 || index == 3 || index == 4 || index == 5){ // 1 ,3 ,5 - Sections with white bacgkrounds
$('.navbar').addClass('navbar-white');
$('#pp-nav, .lang-bottom, .copy-bottom').addClass('white');
}
//else{
// $('.navbar').removeClass('navbar-white');
// $('#pp-nav, .lang-bottom, .copy-bottom').removeClass('white');
//}
//if ( $('.pp-section.active').scrollTop() > 0 ){
// $('.navbar').removeClass('navbar-white');
//}
},
onLeave: function(){
$('.section.active .bg-changer .section-bg').removeClass('active').eq(0).addClass('active');
}
});
/*-------------------------------------------------------------------------------
Scroll into sections
/-------------------------------------------------------------------------------*/
$('.pp-scrollable').on('scroll', function () {
var scrollTop =$(this).scrollTop();
if (scrollTop > 0 ) {
$('.navbar-2').removeClass('navbar-white');
}
else{
$('.navbar-2').addClass('navbar-white');
}
});
/*-------------------------------------------------------------------------------
Scroller navigation
/-------------------------------------------------------------------------------*/
$('#pp-nav').remove().appendTo('.animsition').prepend('').append('').addClass('white right-boxed hidden-xs');
$('.pp-nav-up').on('click', function(){
$.fn.pagepiling.moveSectionUp();
});
$('.pp-nav-down').on('click', function(){
$.fn.pagepiling.moveSectionDown();
});
}
})(jQuery);
var trigged=[],scrollTimeout;
jQuery(function($){
//Trigger rotate
// --------------------
$('.thumb').on('rotate',function(){
var $this = $(this);
$this.addClass('active');
var tout =getRandomInt(3,10)*1000;
setTimeout(function(){
$this.removeClass('active');
},tout)
});
var rotateCycle = setInterval(function(){
var thumbs = $('.thumb:not(.active)');
$(thumbs[getRandomInt(0,thumbs.length)]).trigger('rotate');
},2000);
//Window on resize event
//------------------------------------------------
$(window).resize(function(){
var metro = $('#header .container.visible-phone:visible');
var bricks = metro.find('.brick1');
var size = metro.width()/2.4
bricks.css({width:size,height:size});
});
$(window).trigger('resize');
/**
* Detect IE 10
*/
if (/*@cc_on!@*/false) {
$("html").addClass("ie10");
}
// if ($.browser.msie && $.browser.version == 10) {
// $("html").addClass("ie10");
// }
})
//Custom functions
/**
* Returns a random integer between min and max
* Using Math.round() will give you a non-uniform distribution!
*/
function getRandomInt (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}