/*
* ----------------------------------------------------------------------------------------
Author : CodeTides
Template Name: Anza - One Page MultiPurpose Template
Version : 1.0
* ----------------------------------------------------------------------------------------
*/
(function ($) {
'use strict';
$(document).ready(function () {
/*
* ----------------------------------------------------------------------------------------
* PRELOADER JS
* ----------------------------------------------------------------------------------------
*/
$(window).on("load", function () {
$('.spinner').fadeOut();
$('.preloader-area').delay(350).fadeOut('slow');
});
/*
* ----------------------------------------------------------------------------------------
* CHANGE MENU BACKGROUND JS
* ----------------------------------------------------------------------------------------
*/
$(window).on('scroll', function () {
if ($(window).scrollTop() > 200) {
$('.header-top-area').addClass('menu-bg');
} else {
$('.header-top-area').removeClass('menu-bg');
}
});
/*
* ----------------------------------------------------------------------------------------
* SMOTH SCROOL JS
* ----------------------------------------------------------------------------------------
*/
$('a.smoth-scroll').on("click", function (e) {
var anchor = $(this);
$('html, body').stop().animate({
scrollTop: $(anchor.attr('href')).offset().top - 50
}, 1000);
e.preventDefault();
});
/*
* ----------------------------------------------------------------------------------------
* MAGNIFIC POPUP JS
* ----------------------------------------------------------------------------------------
*/
/*
* ----------------------------------------------------------------------------------------
* PARALLAX JS
* ----------------------------------------------------------------------------------------
*/
// $('.parallax').simpleParallax();
/*
* ----------------------------------------------------------------------------------------
* COUNTER UP JS
* ----------------------------------------------------------------------------------------
*/
$('.counter-num').counterUp();
$('.jarallax').jarallax({
speed: 0.2
});
/*
* ----------------------------------------------------------------------------------------
* Testimonials JS
* ----------------------------------------------------------------------------------------
*/
$(".testimonial-list").owlCarousel({
items: 1,
autoPlay: false,
navigation: false,
itemsDesktop: [1199, 1],
itemsDesktopSmall: [980, 1],
itemsTablet: [768, 1],
itemsTabletSmall: false,
itemsMobile: [479, 1],
pagination: true,
autoHeight: true,
});
/*
* ----------------------------------------------------------------------------------------
* GOOGLE MAP JS
* ----------------------------------------------------------------------------------------
*/
if ( $( "#map" ).length ) {
var myCenter = new google.maps.LatLng(lang,lat);
function initialize() {
var mapProp = {
zoom: 14,
center: myCenter,
scrollwheel: false,
styles: [{
}],
mapTpeIdy: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map"), mapProp);
}
google.maps.event.addDomListener(window, 'load', initialize);
}
/*
* ----------------------------------------------------------------------------------------
* EXTRA JS
* ----------------------------------------------------------------------------------------
*/
$(document).on('click', '.navbar-collapse.in', function (e) {
if ($(e.target).is('a') && $(e.target).attr('class') != 'dropdown-toggle') {
$(this).collapse('hide');
}
});
$('body').scrollspy({
target: '.navbar-collapse',
offset: 195
});
/*
* ----------------------------------------------------------------------------------------
* SCROOL TO UP JS
* ----------------------------------------------------------------------------------------
*/
$(window).on("scroll", function () {
if ($(this).scrollTop() > 250) {
$('.scrollup').fadeIn();
} else {
$('.scrollup').fadeOut();
}
});
$('.scrollup').on("click", function () {
$("html, body").animate({
scrollTop: 0
}, 800);
return false;
});
/*
* ----------------------------------------------------------------------------------------
* WOW JS
* ----------------------------------------------------------------------------------------
*/
new WOW().init();
/*
* ----------------------------------------------------------------------------------------
* SECTION HEADING JS
* ----------------------------------------------------------------------------------------
*/
$(".section-title h2").html(function(){
var text= $(this).text().trim().split(" ");
var first = text.shift();
return (text.length > 0 ? ""+ first + " " : first) + text.join(" ");
});
/*
* ----------------------------------------------------------------------------------------
* FOOTER WIDGET HEADING JS
* ----------------------------------------------------------------------------------------
*/
$(".footer-area .widget-title").html(function(){
var text= $(this).text().trim().split(" ");
var first = text.shift();
return ""+ first + " " + text.join(" ");
});
if ($(window).width() < 768) {
$('.mainmenu li.dropdown').append(function () {
return '';
});
$('ul.nav li.dropdown .fa').click(function(e){
e.stopPropagation();
if ($(this).attr('href') != '#') {
$(this).parent('li').children('ul').slideToggle();
}
else {
toggleDropdown($(this).parent(), 50, 100)
}
});
}
/*
* ----------------------------------------------------------------------------------------
* LOAD Map IN Footer
* ----------------------------------------------------------------------------------------
*/
$('.show_hide_map').click(function(){
$("#mapicon").toggleClass("spin");
$("#mapicon").toggleClass("spinBack");
$(".map_hide").slideToggle("slow");//or .toggle() for instant showing/hiding
});
/*
* ----------------------------------------------------------------------------------------
* LOAD Isotope blog posts
* ----------------------------------------------------------------------------------------
*/
$(window).on("load", function () {
var $container = $('.blog-post-area');
$container.isotope({
filter: '*',
animationOptions: {
duration: 750,
easing: 'linear',
queue: false
}
});
});
/*
* ----------------------------------------------------------------------------------------
* LOAD MORE JS
* ----------------------------------------------------------------------------------------
*/
});
})(jQuery);