(function($) { 'use strict' /* Mobile Menu */ var app = { dropdown: function() { $('.drop-nav-arrow').on('click', function() { if (!$(this).parent().hasClass('open')) { $(this).parent().addClass('open'); $(this).parent().find('> .drop-nav').slideDown(); } else { $(this).parent().removeClass('open'); $(this).parent().find('> .drop-nav').slideUp(); } }); } } $(document).ready(function() { $('.language-menu .current-lang').on('click', function() { $('.language-menu').toggleClass('active'); $('.language-menu ul').toggle(); }); $('.search-part > a').on('click', function() { $('.search-part').toggleClass('active'); $('.search-part .search-box').slideToggle(); return false; }); $('.scroll').on('click', function() { $("html, body").animate({ scrollTop: $('#reach-to').offset().top }, 2000); return false; }); $(".menu-icon a").on('click', function(e) { if ($(this).hasClass('open')) { $(this).removeClass('open'); $('.menu-main').removeClass('open'); } else { $(this).addClass('open'); $('.menu-main').addClass('open'); } return false; }); $('.menu-icon a').on('click', function() { $('body').toggleClass('hidden-body'); }); $('.icon-find').on('click', function() { $('.location-footer-map').addClass('location-open'); return false; }); $('.icon-find-location').on('click', function() { $('.location-footer-map').removeClass('location-open'); return false; }); $('.date-pick').datepicker() }); $(window).on('load', function() { initComponents(); $('.menu-main ul li').each(function() { if ($(this).find('.drop-nav').length) { $(this).append('') } }); app.dropdown(); equalheight('.equal-inset'); equalheight('.chef-blog'); equalheight('.menu-sector-list'); equalheight('.shop-main-list'); equalheight('.chef-member'); headerFix(); $('#pre-loader').delay(1000).fadeOut(); }); $(window).on('resize', function() { initComponents(); equalheight('.equal-inset'); equalheight('.chef-blog'); equalheight('.menu-sector-list'); equalheight('.shop-main-list'); equalheight('.chef-member'); }); $('.top-arrow').on('click', function() { $("html, body").animate({ scrollTop: 0 }, 600); return false; }); $(window).on('scroll', function() { headerFix(); if ($(this).scrollTop() > 500) { $('.top-arrow').fadeIn(); } else { $('.top-arrow').fadeOut(); } return false; }); function initComponents() { initBg(); } function initBg() { $('.banner-bg').each(function() { var background = $(this).data('background'); $(this).css('background-image', 'url("' + background + '")'); }); } })(jQuery); $(document).on('ready', function() { // Initialize google map var map; // Check google map ID is available or not if (document.getElementById('map') != null) { google.maps.event.addDomListener(window, 'load', initialize); } // Check map is available if ($('.footer-map-outer').length > 0) { $('#footer-map').height('445px'); } if ($('.footer-map-outer1').length > 0) { $('#footer-map').height('300px'); } if ($('.footer-map-outer2').length > 0) { $('#footer-map').height('334px'); } }); /* Quantity -------------------------------------------------------*/ $(function() { // Increase jQuery(document).on('click', '.plus-text', function(e) { e.preventDefault(); var quantityInput = jQuery(this).parents('.quantity').find('input.qty'), newValue = parseInt(quantityInput.val(), 10) + 1, maxValue = parseInt(quantityInput.attr('max'), 10); if (!maxValue) { maxValue = 9999999999; } if ( newValue <= maxValue ) { quantityInput.val(newValue); quantityInput.change(); } }); // Decrease jQuery(document).on('click', '.minus-text', function(e) { e.preventDefault(); var quantityInput = jQuery(this).parents('.quantity').find('input.qty'), newValue = parseInt(quantityInput.val(), 10) - 1, minValue = parseInt(quantityInput.attr('min'), 10); if (!minValue) { minValue = 1; } if ( newValue >= minValue ) { quantityInput.val(newValue); quantityInput.change(); } }); }); function headerFix() { var window_height = $(window).height(), document_height = $(document).height(), topPos = $(document).scrollTop(), header_height = $('header-part').height(); if (topPos > header_height) { if ((window_height < document_height) && $('.header-part').hasClass('sticky')) { $('.header-part').addClass('sticky-fixed'); } } else { $('.header-part').removeClass('sticky-fixed'); } } /* Equal height div for dynamic generated by js */ equalheight = function(container) { var currentTallest = 0, currentRowStart = 0, rowDivs = new Array(), $el, topPosition = 0; $(container).each(function() { $el = $(this); $($el).height('auto') topPostion = $el.position().top; if (currentRowStart != topPostion) { for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) { rowDivs[currentDiv].height(currentTallest); } rowDivs.length = 0; // empty the array currentRowStart = topPostion; currentTallest = $el.height(); rowDivs.push($el); } else { rowDivs.push($el); currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest); } for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) { rowDivs[currentDiv].height(currentTallest); } }); }