$(document).ready(function() {
$("#sticky-form-button").click(function(e) {
e.preventDefault();
if ( window.innerWidth >= 768 ) {
$("#sticky-form-form").finish().animate({ width: 'toggle' });
} else {
$("#sticky-form-form").finish().animate({ height: 'toggle' });
}
});
});
$(document).ready(function() {
$(".blog-card-wrap").slick({
arrows: true,
autoplay: false,
autoplaySpeed: 5000,
nextArrow: '
',
prevArrow: '
',
dots: false,
slidesToShow: 3,
slidesToScroll: 1,
responsive: [
{
breakpoint: 960,
settings: {
slidesToShow: 2
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 1
}
},
]
});
});
var galleryWDPerPage = 9;
$(document).ready(function() {
/*if ( typeof( galleriesWD ) !== 'undefined') {
if(galleriesWD.length != 0){
var galleryContainer = $(this).parents('.dynamic-gallery-des-wrap');
galleriesWDNav(galleryContainer);
galleriesWDShow( galleryContainer, galleriesWD[0].slug );
galleryContainer.find(".galleries-nav-item").click(function() {
var gallerySlug = $(this).attr('data-gallery-slug');
galleriesWDShow(galleryContainer, gallerySlug);
});
}
}*/
$(".dynamic-gallery-description").each(function() {
var galleryContainer = $(this);
var galleryVar = galleryContainer.find('.dynamic-gallery-des-wrap').attr('data-varname');
var galleries = eval(galleryVar);
if(galleries.length != 0){
galleriesWDNav(galleries, galleryContainer);
galleriesWDShow(galleries, galleryContainer, galleries[0].slug);
galleryContainer.find(".galleries-nav-item").click(function() {
var gallerySlug = $(this).attr('data-gallery-slug');
galleriesWDShow(galleries, galleryContainer, gallerySlug);
});
}
});
});
function galleriesWDNav(galleriesWD, container) {
var html = '';
for (var i = 0; i < galleriesWD.length; ++i) {
var slug = galleriesWD[i].slug;
var title = galleriesWD[i].title;
html += '- ' + title + '
';
}
html += '
';
container.find(".galleries-des-nav").html(html);
}
function galleriesWDShow(galleriesWD, container, slug, first = 0) {
container.find(".galleries-nav-item").removeClass('current');
container.find(".galleries-nav-item[data-gallery-slug=\"" + slug + "\"]").addClass('current');
var gallery = false;
for (var i = 0; i < galleriesWD.length; ++i) {
if (galleriesWD[i].slug == slug) {
gallery = galleriesWD[i];
break;
}
}
if (gallery) {
var html = '';
for (var i = first; i < gallery.images.length && i < (first + galleryWDPerPage); ++i) {
var thisImage = gallery.images[i];
html += ' ';
}
var description = '';
description += '' + gallery.title + '
';
description += '' + gallery.description + '
';
container.find(".galleries-description").html( description );
container.find(".galleries-des-thumbs").html(html);
container.find(".gallery-thumb").click(function(e) {
e.preventDefault();
var startIndex = parseInt($(this).attr('data-image-index'));
$.magnificPopup.open({
type: 'image',
tLoading: 'Loading image #%curr%...',
gallery: {
enabled: true,
navigateByImgClick: true,
preload: [0,1] // Will preload 0 - before current, and 1 after the current image
},
items: gallery.images,
}, startIndex);
});
galleriesWDPagination(galleriesWD, container, gallery, first);
}
else {
alert('Gallery not found.');
}
}
function galleriesWDPagination(galleriesWD, container, gallery, first) {
var paginationHTML = '';
var totalImages = gallery.images.length;
var totalPages = Math.ceil(totalImages / galleryWDPerPage);
if (totalPages > 1) {
paginationHTML += '
';
for (var i = 1; i <= totalPages; ++i) {
var currentPage = Math.floor(first / galleryWDPerPage) + 1;
if (i == currentPage) {
paginationHTML += '' + i + '';
}
else {
paginationHTML += '' + i + '';
}
}
paginationHTML += '
';
}
container.find(".galleries-des-pagination").html(paginationHTML);
container.find(".gallery-page-link").off().click(function() {
var targetPage = parseInt($(this).attr('data-gallery-page-index'));
var targetImage = (targetPage - 1) * galleryWDPerPage;
galleriesWDShow(galleriesWD, container, gallery.slug, targetImage);
$("body, html").animate({scrollTop: container.offset().top}, 100);
});
container.find(".prev-gallery-page").off().click(function() {
if (currentPage > 1) {
galleriesWDShow(galleriesWD, container, gallery.slug, (currentPage - 2) * galleryWDPerPage);
$("body, html").animate({scrollTop: container.offset().top}, 100);
}
});
container.find(".next-gallery-page").off().click(function() {
if (currentPage < totalPages) {
galleriesWDShow(galleriesWD, container, gallery.slug, (currentPage) * galleryWDPerPage);
$("body, html").animate({scrollTop: container.offset().top}, 100);
}
});
}
var galleryPerPage = 9;
$(document).ready(function() {
/*if ( typeof( galleries ) !== 'undefined') {
if(galleries.length != 0){
var galleryContainer = $(this).parents('.dynamic-gallery-wrap');
galleriesNav(galleryContainer);
galleriesShow(galleryContainer, 'all');
galleryContainer.find(".galleries-nav-item").click(function() {
var gallerySlug = $(this).attr('data-gallery-slug');
galleriesShow(galleryContainer, gallerySlug);
});
}
}*/
$(".dynamic-gallery").each(function() {
var galleryContainer = $(this);
var galleryVar = galleryContainer.find('.dynamic-gallery-wrap').attr('data-varname');
var galleries = eval(galleryVar);
if(galleries.length != 0){
galleriesNav(galleries, galleryContainer);
galleriesShow(galleries, galleryContainer, 'all');
galleryContainer.find(".galleries-nav-item").click(function() {
var gallerySlug = $(this).attr('data-gallery-slug');
galleriesShow(galleries, galleryContainer, gallerySlug);
});
}
});
});
function galleriesNav(galleries, container) {
var html = '';
for (var i = 0; i < galleries.length; ++i) {
var slug = galleries[i].slug;
var title = galleries[i].title;
html += '- ' + title + '
';
}
html += '
';
container.find(".galleries-nav").html(html);
}
function galleriesShow(galleries, container, slug, first = 0) {
container.find(".galleries-nav-item").removeClass('current');
container.find(".galleries-nav-item[data-gallery-slug=\"" + slug + "\"]").addClass('current');
var gallery = false;
for (var i = 0; i < galleries.length; ++i) {
if (galleries[i].slug == slug) {
gallery = galleries[i];
break;
}
}
if (gallery) {
var html = '';
for (var i = first; i < gallery.images.length && i < (first + galleryPerPage); ++i) {
var thisImage = gallery.images[i];
html += '';
//
}
container.find(".galleries-thumbs").html(html);
/*
$(".galleries-thumbs").magnificPopup({
//delegate: 'a',
type: 'image',
tLoading: 'Loading image #%curr%...',
gallery: {
enabled: true,
navigateByImgClick: true,
preload: [0,1] // Will preload 0 - before current, and 1 after the current image
},
items: galleries[0].images,
});
*/
container.find(".gallery-thumb").click(function(e) {
e.preventDefault();
var startIndex = parseInt($(this).attr('data-image-index'));
$.magnificPopup.open({
type: 'image',
tLoading: 'Loading image #%curr%...',
gallery: {
enabled: true,
navigateByImgClick: true,
preload: [0,1] // Will preload 0 - before current, and 1 after the current image
},
items: gallery.images,
}, startIndex);
});
galleriesPagination(galleries, container, gallery, first);
}
else {
alert('Gallery not found.');
}
}
function galleriesPagination(galleries, container, gallery, first) {
var paginationHTML = '';
var totalImages = gallery.images.length;
var totalPages = Math.ceil(totalImages / galleryPerPage);
if (totalPages > 1) {
paginationHTML += '
';
for (var i = 1; i <= totalPages; ++i) {
var currentPage = Math.floor(first / galleryPerPage) + 1;
if (i == currentPage) {
paginationHTML += '' + i + '';
}
else {
paginationHTML += '' + i + '';
}
}
paginationHTML += '
';
}
container.find(".galleries-pagination").html(paginationHTML);
container.find(".gallery-page-link").off().click(function() {
var targetPage = parseInt($(this).attr('data-gallery-page-index'));
var targetImage = (targetPage - 1) * galleryPerPage;
galleriesShow(galleries, container, gallery.slug, targetImage);
$("body, html").animate({scrollTop: container.offset().top}, 100);
});
container.find(".prev-gallery-page").off().click(function() {
if (currentPage > 1) {
galleriesShow(galleries, container, gallery.slug, (currentPage - 2) * galleryPerPage);
$("body, html").animate({scrollTop: container.offset().top}, 100);
}
});
container.find(".next-gallery-page").off().click(function() {
if (currentPage < totalPages) {
galleriesShow(galleries, container, gallery.slug, (currentPage) * galleryPerPage);
$("body, html").animate({scrollTop: container.offset().top}, 100);
}
});
}
$(document).ready(function() {
$('.gallery-item').magnificPopup({
delegate: 'a', // child items selector, by clicking on it popup will open
type: 'image',
gallery: {
enabled: true
}
});
});
$(document).ready(function() {
$('.gallery-item').magnificPopup({
delegate: 'a', // child items selector, by clicking on it popup will open
type: 'image',
gallery: {
enabled: true
}
});
});
$(document).ready(function() {
$( ".slider-wrap" ).slick({
arrows: true,
autoplay: true,
autoplaySpeed: 5000,
nextArrow: '
',
prevArrow: '
',
dots: true,
slidesToShow: 1,
slidesToScroll: 1
});
});
/*$(document).ready(function() {
$( ".logo-grid-items" ).slick({
arrows: true,
autoplay: true,
autoplaySpeed: 5000,
nextArrow: '
',
prevArrow: '
',
dots: false,
slidesToShow: 5,
slidesToScroll: 1,
responsive: [
{
breakpoint: 1200,
settings: {
slidesToShow: 4
}
},
{
breakpoint: 1023,
settings: {
slidesToShow: 3
}
}
]
});
});
*/
$(document).ready(function() {
$('.gallery-item').magnificPopup({
delegate: 'a', // child items selector, by clicking on it popup will open
type: 'image',
gallery: {
enabled: true
}
});
});
/*$(document).ready(function() {
$( ".logo-grid-items" ).slick({
arrows: true,
autoplay: true,
autoplaySpeed: 5000,
nextArrow: '
',
prevArrow: '
',
dots: false,
slidesToShow: 5,
slidesToScroll: 1,
responsive: [
{
breakpoint: 1200,
settings: {
slidesToShow: 4
}
},
{
breakpoint: 1023,
settings: {
slidesToShow: 3
}
}
]
});
});
*/
$(document).ready(function() {
$( ".testimonial-slider-wrap" ).slick({
arrows: true,
autoplay: true,
autoplaySpeed: 5000,
nextArrow: '
',
prevArrow: '
',
dots: false,
slidesToShow: 1,
slidesToScroll: 1
});
});
$(document).ready(function() {
$(".testimonial-card-wrap").slick({
arrows: true,
autoplay: false,
autoplaySpeed: 5000,
nextArrow: '
',
prevArrow: '
',
dots: false,
slidesToShow: 3,
slidesToScroll: 1,
responsive: [
{
breakpoint: 960,
settings: {
slidesToShow: 2
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 1
}
},
]
});
});
$(document).ready(function() {
$("#nav-toggle").click(function() {
$(".zdheader-diesel .main-nav").toggleClass('open').finish().slideToggle();
});
$(".zdheader-diesel .main-nav .menu .menu-item-has-children").on('click touchend', function(e) {
if (window.innerWidth <= 1200) {
var clicked = $(e.target);
var nodeName = clicked.context.nodeName;
if (nodeName.toUpperCase() == 'A') {
clicked = clicked.parent();
}
if (clicked.children('.sub-menu').length > 0) {
e.stopPropagation();
e.preventDefault();
$(this).toggleClass('open');
$(this).children('.sub-menu').finish().slideToggle();
}
}
});
$("html, body").on('click touchend', function(e) {
var clicked = $(e.target);
if ($(".zdheader-diesel .main-nav").hasClass('open') && clicked.attr('id') != 'main-nav' && clicked.parents(".zdheader-diesel .main-nav").length == 0 && clicked.attr('id') != 'nav-toggle' && clicked.parents("#nav-toggle").length == 0) {
e.stopPropagation();
e.preventDefault();
$(".zdheader-diesel .main-nav").removeClass('open').finish().slideUp();
}
});
$(window).on('resize orientationchange load', function() {
headerMenu();
});
$(window).on('resize orientationchange load scroll', function() {
if (window.innerWidth > 1200) {
$(".menu .open").removeClass('open');
$(".zdheader-diesel .main-nav, .menu, .sub-menu").css('display', '');
}
});
function headerMenu() {
if (window.innerWidth > 1200) {
$(".zdheader-diesel .main-nav").css('display', '');
}
}
});