;(function () {
'use strict';
// ipad and ipod detection
var isipad = function(){
return (navigator.platform.indexof("ipad") != -1);
};
var isiphone = function(){
return (
(navigator.platform.indexof("iphone") != -1) ||
(navigator.platform.indexof("ipod") != -1)
);
};
// offcanvass
var offcanvass = function() {
$('body').on('click', '.js-fh5co-nav-toggle', function(event){
var $this = $(this);
$('#fh5co-offcanvass').toggleclass('fh5co-awake');
$('#fh5co-page, #fh5co-menu').toggleclass('fh5co-sleep');
if ( $('#fh5co-offcanvass').hasclass('fh5co-awake') ) {
$this.addclass('active');
} else {
$this.removeclass('active');
}
event.preventdefault();
});
};
// single page nav
var clickmenu = function() {
$('a:not([class="external"])').click(function(){
var section = $(this).data('nav-section')
$('html, body').animate({
scrolltop: $('[data-section="' + section + '"]').offset().top
}, 500);
return false;
});
};
// owl carousel
var carouseltestimony = function() {
var owl = $(".owl-carousel");
owl.owlcarousel({
items: 1,
margin: 0,
responsiveclass: true,
loop: true,
nav: true,
dots: true,
autoplay: true,
smartspeed: 500,
responsive:{
0:{
nav:false
},
480: {
nav:false
},
768:{
nav:false
},
1000:{
nav:true,
}
},
navtext: [
"",
""
]
});
};
var footerfixed = function() {
var fh = $('#fh5co-footer').innerheight();
$('#fh5co-wrap').css({
});
if ( $(window).width() < 991 ) {
$('#fh5co-wrap').css({
})
}
$(window).resize(function(){
var fh = $('#fh5co-footer').innerheight();
$('#fh5co-wrap').css({
});
if ( $(window).width() < 991 ) {
$('#fh5co-wrap').css({
})
}
});
};
// counter
var counter = function() {
$('.js-counter').countto({
formatter: function (value, options) {
return value.tofixed(options.decimals);
},
});
};
// faqs accordion
var faqsaccordion = function() {
var faqacc = $('.faq-accordion h3');
// click
faqacc.on('click', function(event){
var $this = $(this);
$('.faq-accordion').removeclass('active');
$('.faq-accordion').find('.faq-body').slideup(400, 'easeinoutexpo');
if ( !$this.closest('.faq-accordion').find('.faq-body').is(':visible')) {
$this.closest('.faq-accordion').addclass('active');
$this.closest('.faq-accordion').find('.faq-body').slidedown(400, 'easeinoutexpo');
} else {
$this.closest('.faq-accordion').removeclass('active');
$this.closest('.faq-accordion').find('.faq-body').slideup(400, 'easeinoutexpo');
}
settimeout(function(){
// alert($this.closest('.faq-accordion.active').innerheight());
$('html, body').animate({
scrolltop: $this.closest('.faq-accordion.active').offset().top - 90
}, 500);
}, 700);
event.preventdefault();
return false;
});
};
// click outside of offcanvass
var mobilemenuoutsideclick = function() {
$(document).click(function (e) {
var container = $("#fh5co-offcanvass, .js-fh5co-nav-toggle");
if (!container.is(e.target) && container.has(e.target).length === 0) {
if ( $('#fh5co-offcanvass').hasclass('fh5co-awake') ) {
$('#fh5co-offcanvass').removeclass('fh5co-awake');
$('#fh5co-page, #fh5co-menu').removeclass('fh5co-sleep');
$('.js-fh5co-nav-toggle').removeclass('active');
}
}
});
$(window).scroll(function(){
var $menu = $('#fh5co-menu');
if ( $(window).scrolltop() > 150 ) {
$menu.addclass('sleep');
}
if ( $(window).scrolltop() < 500 ) {
$menu.removeclass('sleep');
$('#fh5co-offcanvass ul li').removeclass('active');
$('#fh5co-offcanvass ul li').first().addclass('active');
}
if ( $(window).scrolltop() > 500 ) {
if ( $('#fh5co-offcanvass').hasclass('fh5co-awake') ) {
$('#fh5co-offcanvass').removeclass('fh5co-awake');
$('#fh5co-page, #fh5co-menu').removeclass('fh5co-sleep');
$('.js-fh5co-nav-toggle').removeclass('active');
}
}
});
};
// magnific popup
var magnifpopup = function() {
$('.image-popup').magnificpopup({
type: 'image',
removaldelay: 300,
mainclass: 'mfp-with-zoom',
titlesrc: 'title',
gallery:{
enabled:true
},
zoom: {
enabled: true, // by default it's false, so don't forget to enable it
duration: 300, // duration of the effect, in milliseconds
easing: 'ease-in-out', // css transition easing function
// the "opener" function should return the element from which popup will be zoomed in
// and to which popup will be scaled down
// by defailt it looks for an image tag:
opener: function(openerelement) {
// openerelement is the element on which popup was initialized, in this case its tag
// you don't need to add "opener" option if this code matches your needs, it's defailt one.
return openerelement.is('img') ? openerelement : openerelement.find('img');
}
}
});
};
//图片1
$(document).ready(function() {
$('.popup-gallery1').magnificpopup({
delegate: 'a',
type: 'image',
tloading: 'loading image #%curr%...',
mainclass: 'mfp-img-mobile',
gallery: {
enabled: true,
navigatebyimgclick: true,
preload: [0,1] // will preload 0 - before current, and 1 after the current image
},
image: {
terror: 'the image #%curr% could not be loaded.',
titlesrc: function(item) {
}
}
});
});
//图片2
$(document).ready(function() {
$('.popup-gallery2').magnificpopup({
delegate: 'a',
type: 'image',
tloading: 'loading image #%curr%...',
mainclass: 'mfp-img-mobile',
gallery: {
enabled: true,
navigatebyimgclick: true,
preload: [0,1] // will preload 0 - before current, and 1 after the current image
},
image: {
terror: 'the image #%curr% could not be loaded.',
titlesrc: function(item) {
}
}
});
});
//图片3
$(document).ready(function() {
$('.popup-gallery3').magnificpopup({
delegate: 'a',
type: 'image',
tloading: 'loading image #%curr%...',
mainclass: 'mfp-img-mobile',
gallery: {
enabled: true,
navigatebyimgclick: true,
preload: [0,1] // will preload 0 - before current, and 1 after the current image
},
image: {
terror: 'the image #%curr% could not be loaded.',
titlesrc: function(item) {
}
}
});
});
//图片4
$(document).ready(function() {
$('.popup-gallery4').magnificpopup({
delegate: 'a',
type: 'image',
tloading: 'loading image #%curr%...',
mainclass: 'mfp-img-mobile',
gallery: {
enabled: true,
navigatebyimgclick: true,
preload: [0,1] // will preload 0 - before current, and 1 after the current image
},
image: {
terror: 'the image #%curr% could not be loaded.',
titlesrc: function(item) {
}
}
});
});
//图片5
$(document).ready(function() {
$('.popup-gallery5').magnificpopup({
delegate: 'a',
type: 'image',
tloading: 'loading image #%curr%...',
mainclass: 'mfp-img-mobile',
gallery: {
enabled: true,
navigatebyimgclick: true,
preload: [0,1] // will preload 0 - before current, and 1 after the current image
},
image: {
terror: 'the image #%curr% could not be loaded.',
titlesrc: function(item) {
}
}
});
});
//图片6
$(document).ready(function() {
$('.popup-gallery6').magnificpopup({
delegate: 'a',
type: 'image',
tloading: 'loading image #%curr%...',
mainclass: 'mfp-img-mobile',
gallery: {
enabled: true,
navigatebyimgclick: true,
preload: [0,1] // will preload 0 - before current, and 1 after the current image
},
image: {
terror: 'the image #%curr% could not be loaded.',
titlesrc: function(item) {
}
}
});
});
//认证1
$(document).ready(function() {
$('.popup-galleryrz1').magnificpopup({
delegate: 'a',
type: 'image',
tloading: 'loading image #%curr%...',
mainclass: 'mfp-img-mobile',
gallery: {
enabled: true,
navigatebyimgclick: true,
preload: [0,1] // will preload 0 - before current, and 1 after the current image
},
image: {
terror: 'the image #%curr% could not be loaded.',
titlesrc: function(item) {
}
}
});
});
//认证2
$(document).ready(function() {
$('.popup-galleryrz2').magnificpopup({
delegate: 'a',
type: 'image',
tloading: 'loading image #%curr%...',
mainclass: 'mfp-img-mobile',
gallery: {
enabled: true,
navigatebyimgclick: true,
preload: [0,1] // will preload 0 - before current, and 1 after the current image
},
image: {
terror: 'the image #%curr% could not be loaded.',
titlesrc: function(item) {
}
}
});
});
//认证3
$(document).ready(function() {
$('.popup-galleryrz3').magnificpopup({
delegate: 'a',
type: 'image',
tloading: 'loading image #%curr%...',
mainclass: 'mfp-img-mobile',
gallery: {
enabled: true,
navigatebyimgclick: true,
preload: [0,1] // will preload 0 - before current, and 1 after the current image
},
image: {
terror: 'the image #%curr% could not be loaded.',
titlesrc: function(item) {
}
}
});
});
//认证4
$(document).ready(function() {
$('.popup-galleryrz4').magnificpopup({
delegate: 'a',
type: 'image',
tloading: 'loading image #%curr%...',
mainclass: 'mfp-img-mobile',
gallery: {
enabled: true,
navigatebyimgclick: true,
preload: [0,1] // will preload 0 - before current, and 1 after the current image
},
image: {
terror: 'the image #%curr% could not be loaded.',
titlesrc: function(item) {
}
}
});
});
// scroll animations
// intro animate
var introwaypoint = function() {
if ( $('#fh5co-hero').length > 0 ) {
$('#fh5co-hero').waypoint( function( direction ) {
if( direction === 'down' && !$(this).hasclass('animated') ) {
settimeout(function(){
$('.intro-animate-1').addclass('fadeinup animated');
}, 100);
settimeout(function(){
$('.intro-animate-2').addclass('fadeinup animated');
}, 400);
settimeout(function(){
$('.intro-animate-3').addclass('fadeinup animated');
$('.intro-animate-4').addclass('fadeinup animated');
}, 700);
$(this.element).addclass('animated');
}
} , { offset: '75%' } );
}
};
var headertoggle = function() {
var $this = $( '#fh5co-main' );
$this.waypoint(function(direction) {
if( direction === 'down' ) {
$('body').addclass('scrolled');
}
else if( direction === 'up' ){
$('body').removeclass('scrolled');
}
}, { offset: '-1px' } );
};
// client animate
var clientanimate = function() {
if ( $('#fh5co-clients').length > 0 ) {
$('#fh5co-clients .to-animate').each(function( k ) {
var el = $(this);
settimeout ( function () {
el.addclass('fadein animated');
}, k * 200, 'easeinoutexpo' );
});
}
};
var clientwaypoint = function() {
if ( $('#fh5co-clients').length > 0 ) {
$('#fh5co-clients').waypoint( function( direction ) {
if( direction === 'down' && !$(this).hasclass('animated') ) {
settimeout(clientanimate, 100);
$(this.element).addclass('animated');
}
} , { offset: '75%' } );
}
};
// features animate
var featuresanimate = function() {
if ( $('#fh5co-features').length > 0 ) {
$('#fh5co-features .to-animate').each(function( k ) {
var el = $(this);
settimeout ( function () {
el.addclass('fadeinup animated');
}, k * 200, 'easeinoutexpo' );
});
}
};
var featureswaypoint = function() {
if ( $('#fh5co-features').length > 0 ) {
$('#fh5co-features').waypoint( function( direction ) {
if( direction === 'down' && !$(this).hasclass('animated') ) {
settimeout(featuresanimate, 100);
$(this.element).addclass('animated');
}
} , { offset: '75%' } );
}
};
// features 2 animate
var features2animatetitle = function() {
if ( $('#fh5co-features-2').length > 0 ) {
$('#fh5co-features-2 .to-animate').each(function( k ) {
var el = $(this);
settimeout ( function () {
el.addclass('fadein animated');
}, k * 200, 'easeinoutexpo' );
});
}
};
var features2waypoint = function() {
if ( $('#fh5co-features-2').length > 0 ) {
$('#fh5co-features-2').waypoint( function( direction ) {
if( direction === 'down' && !$(this).hasclass('animated') ) {
settimeout(features2animatetitle, 100);
settimeout(function(){
$('.features-2-animate-2').addclass('fadeinup animated');
}, 800);
settimeout(function(){
$('.features-2-animate-3').addclass('fadeinright animated');
$('.features-2-animate-5').addclass('fadeinleft animated');
}, 1200);
settimeout(function(){
$('.features-2-animate-4').addclass('fadeinright animated');
$('.features-2-animate-6').addclass('fadeinleft animated');
}, 1400);
$(this.element).addclass('animated');
}
} , { offset: '75%' } );
}
};
var counterwaypoint = function() {
if ( $('#fh5co-counter').length > 0 ) {
$('#fh5co-counter').waypoint( function( direction ) {
if( direction === 'down' && !$(this).hasclass('animated') ) {
settimeout(function(){
$('.counter-animate').addclass('fadeinup animated');
counter();
}, 100);
$(this.element).addclass('animated');
}
} , { offset: '75%' } );
}
};
// products animate
var productsanimate = function() {
if ( $('#fh5co-products').length > 0 ) {
$('#fh5co-products .to-animate').each(function( k ) {
var el = $(this);
settimeout ( function () {
el.addclass('fadeinup animated');
}, k * 200, 'easeinoutexpo' );
});
}
};
var productswaypoint = function() {
if ( $('#fh5co-products').length > 0 ) {
$('#fh5co-products').waypoint( function( direction ) {
if( direction === 'down' && !$(this).hasclass('animated') ) {
settimeout(function(){
$('.product-animate-1').addclass('fadein animated');
}, 200);
settimeout(function(){
$('.product-animate-2').addclass('fadein animated');
}, 400);
settimeout(productsanimate, 800);
$(this.element).addclass('animated');
}
} , { offset: '75%' } );
}
};
// call to actions animate
var ctaanimate = function() {
if ( $('#fh5co-cta').length > 0 ) {
$('#fh5co-cta .to-animate').each(function( k ) {
var el = $(this);
settimeout ( function () {
el.addclass('fadeinup animated');
}, k * 200, 'easeinoutexpo' );
});
}
};
var ctawaypoint = function() {
if ( $('#fh5co-cta').length > 0 ) {
$('#fh5co-cta').waypoint( function( direction ) {
if( direction === 'down' && !$(this).hasclass('animated') ) {
settimeout(ctaanimate, 100);
$(this.element).addclass('animated');
}
} , { offset: '75%' } );
}
};
// pricing animate
var pricinganimate = function() {
if ( $('#fh5co-pricing').length > 0 ) {
$('#fh5co-pricing .to-animate').each(function( k ) {
var el = $(this);
settimeout ( function () {
el.addclass('fadeinup animated');
}, k * 200, 'easeinoutexpo' );
});
}
};
var pricingwaypoint = function() {
if ( $('#fh5co-pricing').length > 0 ) {
$('#fh5co-pricing').waypoint( function( direction ) {
if( direction === 'down' && !$(this).hasclass('animated') ) {
settimeout(function(){
$('.pricing-animate-1').addclass('fadeinup animated');
}, 100);
settimeout(function(){
$('.pricing-animate-2').addclass('fadeinup animated');
}, 400);
settimeout(pricinganimate, 800);
$(this.element).addclass('animated');
}
} , { offset: '75%' } );
}
};
// features 3 animate
var features3animate = function() {
if ( $('#fh5co-features-3').length > 0 ) {
$('#fh5co-features-3 .to-animate').each(function( k ) {
var el = $(this);
settimeout ( function () {
el.addclass('fadeinup animated');
}, k * 200, 'easeinoutexpo' );
});
}
};
var features3waypoint = function() {
if ( $('#fh5co-features-3').length > 0 ) {
$('#fh5co-features-3').waypoint( function( direction ) {
if( direction === 'down' && !$(this).hasclass('animated') ) {
settimeout(function(){
$('.features3-animate-1').addclass('fadein animated');
}, 200);
settimeout(function(){
$('.features3-animate-2').addclass('fadein animated');
}, 400);
settimeout(features3animate, 800);
$(this.element).addclass('animated');
}
} , { offset: '75%' } );
}
};
// features 3 animate
var faqsanimate = function() {
if ( $('#fh5co-faqs').length > 0 ) {
$('#fh5co-faqs .to-animate').each(function( k ) {
var el = $(this);
settimeout ( function () {
el.addclass('fadeinup animated');
}, k * 200, 'easeinoutexpo' );
});
}
};
var faqswaypoint = function() {
if ( $('#fh5co-faqs').length > 0 ) {
$('#fh5co-faqs').waypoint( function( direction ) {
if( direction === 'down' && !$(this).hasclass('animated') ) {
settimeout(function(){
$('.faqs-animate-1').addclass('fadein animated');
}, 200);
settimeout(function(){
$('.faqs-animate-2').addclass('fadein animated');
}, 400);
settimeout(faqsanimate, 800);
$(this.element).addclass('animated');
}
} , { offset: '75%' } );
}
};
// animate-box
var contentwaypoint = function() {
$('.animate-box').waypoint( function( direction ) {
if( direction === 'down' && !$(this).hasclass('animated') ) {
$(this.element).addclass('fadeinup animated');
}
} , { offset: '75%' } );
};
// reflect scrolling in navigation
var navactive = function(section) {
var el = $('#fh5co-offcanvass > ul');
el.find('li').removeclass('active');
el.each(function(){
$(this).find('a[data-nav-section="'+section+'"]').closest('li').addclass('active');
});
};
var navigationsection = function() {
var $section = $('div[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; }
});
};
// document on load.
$(function(){
magnifpopup();
offcanvass();
mobilemenuoutsideclick();
footerfixed();
faqsaccordion();
carouseltestimony();
clickmenu();
headertoggle();
// animations
introwaypoint();
clientwaypoint();
featureswaypoint();
features2waypoint();
counterwaypoint();
productswaypoint();
features3waypoint();
ctawaypoint();
pricingwaypoint();
faqswaypoint();
contentwaypoint();
navigationsection();
});
}());