/**
File : custom.js
Version : 1.0
**/
var ZESTO = function(){
/* Main Search Bar ============ */
websitePath = '';
var screenWidthVar = jQuery( window ).width();
var mainSearch = function() {
'use strict';
/* main search in header on click function */
var quikSearch = jQuery("#daz-search-btn");
var quikSearchRemove = jQuery("#daz-search-remove");
quikSearch.on('click',function() {
jQuery('.daz-search').fadeIn(500);
jQuery('.daz-search').addClass('On');
});
quikSearchRemove.on('click',function() {
jQuery('.daz-search').fadeOut(500);
jQuery('.daz-search').removeClass('On');
});
/* main search in header on click function End*/
}
/* One Page Layout ============ */
var dazOnePageLayout = function() {
'use strict';
var headerHeight = parseInt(jQuery('.onepage').css('height'), 10);
jQuery(".scroll").unbind().on('click',function(event)
{
event.preventDefault();
if (this.hash !== "") {
var hash = this.hash;
var seactionPosition = jQuery(hash).offset().top;
var headerHeight = parseInt(jQuery('.onepage').css('height'), 10);
jQuery('body').scrollspy({target: ".navbar", offset: headerHeight+2});
var scrollTopPosition = seactionPosition - (headerHeight);
jQuery('html, body').animate({
scrollTop: scrollTopPosition
}, 800, function(){
});
}
});
jQuery('body').scrollspy({target: ".navbar", offset: headerHeight + 2});
}
/* Header Height ============ */
var manageResizeElement = function(){
var headerHeight = jQuery('.header').height();
jQuery('.header').css('height', headerHeight);
}
/* Theme Loading Files Imp ============ */
var dazTheme = function(){
'use strict';
var loadingImage = '
';
jQuery('.dzload').each(function(){
var dazsrc = websitePath + jQuery(this).attr('dzsrc');
//jQuery(this).html(loadingImage);
jQuery(this).hide(function(){
jQuery(this).load(dazsrc, function(){
jQuery(this).fadeIn('slow');
});
})
});
if(screenWidthVar < 991){
var logoData = jQuery('
').append(jQuery('.mobile-nav .daz-logo').clone()).html();
jQuery('.mobile-nav .header-nav').prepend(logoData);
jQuery('.mobile-nav .header-nav .daz-logo > a > img').attr('src','images/logo.png');
jQuery('.mobile-nav.lw .header-nav .daz-logo > a > img').attr('src','images/logo-white.png');
}
}
/* Scroll To Top Imp ============ */
var dazScrollTop = function (){
'use strict';
var scrollTop = jQuery("button.scroltop");
/* page scroll top on click function */
scrollTop.on('click',function() {
jQuery("html, body").animate({
scrollTop: 0
}, 1000);
return false;
})
jQuery(window).bind("scroll", function() {
var scroll = jQuery(window).scrollTop();
if (scroll > 900) {
jQuery("button.scroltop").fadeIn(1000);
} else {
jQuery("button.scroltop").fadeOut(1000);
}
});
/* page scroll top on click function end*/
}
/* Header Fixed Imp ============ */
var dazHeaderFix = function(){
'use strict';
/* Main navigation fixed on top when scroll down function custom */
jQuery(window).bind('scroll', function () {
if(jQuery('.header-sticky').length)
{
var menu = jQuery('.header-sticky');
if (jQuery(window).scrollTop() > menu.offset().top) {
menu.addClass('is-fixed');
} else {
menu.removeClass('is-fixed');
}
}
});
/* Main navigation fixed on top when scroll down function custom end*/
}
var dazBoxHover = function(){
jQuery('.box-hover').on('mouseenter',function(){
jQuery('.box-hover').removeClass('active');
jQuery(this).addClass('active');
})
}
/* Resizebanner Imp ============ */
var manageBannerResize = function(){
jQuery(".full-height").css("height", jQuery(window).height());
}
/* Left Menu Imp ============ */
var manageSideBarMenu = function(){
jQuery('.openbtn').on('click',function(e){
e.preventDefault();
if(jQuery('#mySidenav').length > 0)
{
document.getElementById("mySidenav").style.left = "0";
}
if(jQuery('#mySidenav1').length > 0)
{
document.getElementById("mySidenav1").style.right = "0";
}
})
jQuery('.closebtn').on('click',function(e){
e.preventDefault();
if(jQuery('#mySidenav').length > 0)
{
document.getElementById("mySidenav").style.left = "-300px";
}
if(jQuery('#mySidenav1').length > 0)
{
document.getElementById("mySidenav1").style.right = "-820px";
}
})
}
/* Function ============ */
return {
init:function(){
dazOnePageLayout();
dazTheme();
dazBoxHover();
manageResizeElement();
mainSearch();
dazScrollTop();
dazHeaderFix();
manageSideBarMenu();
manageBannerResize();
},
load:function(){
}
}
}();
/* Blog post Carousel function by = owl.carousel.js */
jQuery('.main-slider').owlCarousel({
loop:true,
autoplay:true,
item:1,
nav:true,
dots: true,
navText: ['', ''],
responsive:{
0:{
items:1
}
}
})
/* Blog post Carousel function by = owl.carousel.js */
jQuery('.blog-carousel').owlCarousel({
loop:true,
autoplay:true,
margin:30,
nav:true,
dots: false,
navText: ['', ''],
responsive:{
0:{
items:1
},
480:{
items:2
},
991:{
items:2
},
1000:{
items:3
}
}
})
/* Jquery ready Start */
jQuery(document).ready(function() {
ZESTO.init();
var screenWidthVar = jQuery( window ).width();
if(screenWidthVar <= 991 )
{
jQuery('.navbar-nav > li > a, .sub-menu > li > a').on('click', function(e){
//e.preventDefault();
if(jQuery(this).parent().hasClass('open'))
{
jQuery(this).parent().removeClass('open');
}
else{
jQuery(this).parent().parent().find('li').removeClass('open');
jQuery(this).parent().addClass('open');
}
});
}
jQuery('.menuicon').on('click',function(){
jQuery(this).toggleClass('open');
});
});
/* Jquery ready END */
/* Window Load START */
jQuery(window).on("load", function (e) {
ZESTO.load();
setTimeout(function(){
jQuery('#loading-area').remove();
}, 0);
});
(function($) {
"use strict";
/* Window Load END */
$(document).ready(function() {
$(".header-nav").accessibleDropDown();
});
$.fn.accessibleDropDown = function () {
var el = $(this);
/* Make dropdown menus keyboard accessible */
$("a", el).focus(function() {
$(this).parents("li").addClass("force-show");
}).blur(function() {
$(this).parents("li").removeClass("force-show");
});
}
})(window.jQuery);