/*
Template Name: United Pets
Author: Ingrid Kuhn
Author URI: themeforest/user/ingridk
Version: 1.3
*/
jQuery(function($) {
//----------------------------------- Document ready -----------------------------------//
$(document).ready(function() {
//baguette lightbox
baguetteBox.run('.tz-gallery');
// Page Preloader
$("#preloader").fadeOut("slow");
//Scrolling feature
$('.page-scroll a').on('click', function(event) {
var $anchor = $(this);
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top
}, 1500, 'easeInOutExpo');
event.preventDefault();
});
//Dropdown on hover
if ($(window).width() > 1200) {
$(".navbar .dropdown").on({
mouseenter: function () {
$(this).find('.dropdown-menu').first().stop(true, true).delay(50).slideDown();
},
mouseleave: function () {
$(this).find('.dropdown-menu').first().stop(true, true).delay(100).fadeOut();
}
});
}
// Back Top Link
var offset = 200;
var duration = 500;
$(window).scroll(function() {
if ($(this).scrollTop() > offset) {
$('.back-to-top').fadeIn(400);
} else {
$('.back-to-top').fadeOut(400);
}
});
//Owl-carousels
$('.owl-stage').owlCarousel({
loop: true,
margin: 0,
autoplay: true,
nav: true,
navText: [" ", " "],
dots: true,
responsive: {
0: {
items: 1,
stagePadding: 0
},
767: {
items: 2,
stagePadding: 60
},
1200: {
items: 3,
stagePadding: 120
},
}
});
$(".carousel-4items").owlCarousel({
nav: true,
navText: ["", ""],
dots: true,
margin: 30,
loop: true,
autoplay: false,
responsiveClass: true,
responsive: {
0: {
items: 1,
},
767: {
items: 2,
},
1200: {
items: 4,
},
}
});
$(".carousel-3items").owlCarousel({
nav: true,
navText: ["", ""],
dots: true,
margin: 30,
loop: true,
autoplay: false,
responsiveClass: true,
responsive: {
0: {
items: 1,
},
767: {
items: 2,
},
1200: {
items: 3,
},
}
});
$(".carousel-2items").owlCarousel({
nav: true,
navText: ["", ""],
dots: true,
margin: 30,
loop: true,
autoplay: false,
responsiveClass: true,
responsive: {
0: {
items: 1,
},
991: {
items: 2,
},
}
});
$(".carousel-1item").owlCarousel({
nav: true,
navText: ["", ""],
dots: true,
margin: 30,
loop: true,
autoplay: false,
responsiveClass: true,
responsive: {
0: {
items: 1,
},
}
});
// Magnific Popup
$('.magnific-popup').magnificPopup({
delegate: 'a', // child items selector, by clicking on it popup will open
type: 'image',
overflowY:'scroll',
gallery: {
enabled: true
},
titleSrc: 'title',
titleSrc: function(item) {
return '' + item.el.attr('title') + '';
},
callbacks: {open: function() {$('.fixed-top').css('margin-right', '17px');},close: function() {$('.fixed-top').css('margin-right', '0px');}}
});
//Effects on scroll
AOS.init({
disable: 'mobile',
duration: 1500,
once: true
});
//Isotope
$('#gallery-isotope').isotope({
itemSelector: '.col-lg-6',
layoutMode: 'masonry'
});
//Isotope Nav Filter
$('.category-isotope a').click(function () {
$('.category-isotope a').removeClass('active');
$(this).addClass('active');
var selector = $(this).attr('data-filter');
$('#gallery-isotope').isotope({
filter: selector
});
return false;
});
// Contact form
$("#submit_btn").on("click", function() {
var proceed = true;
//simple validation at client's end
//loop through each field and we simply change border color to red for invalid fields
$("#contact_form input[required], #contact_form textarea[required]").each(function() {
$(this).css('border-color', '');
if (!$.trim($(this).val())) { //if this field is empty
$(this).css('border-color', '#e44747');
$("#contact_results").html('