/** ***************************************** @file: gardener theme custom js this files contents are outlined below>>>>> ****************************************** * 1. dynamic counting effect * 2. theme banner slider * 3. theme dropdwon * 3. mainmenu submenu toggler * 4. theme carousel * 5. shop price ranger * 6 google map * 7. theme accrodion * 8. theme skin switcher * 9. main menu sticky * 10. theme lightbox active * 11. theme gallery filter ***************************************** **/ "use strict"; // =1. dynamic counting effect function counterup () { if ($('.counter').length) { $('.counter').counterup({ delay: 10, time: 1300 }); }; } // =2. theme banner slider function thmrevslider () { if ($("#main_slider").length) { $("#main_slider").revolution({ slidertype:"standard", sliderlayout:"auto", loops:false, delay:5000, navigation: { arrows: { style: "hades", enable: true, hide_onmobile: false, hide_onleave: false, tmp: '
', left: { h_align: "left", v_align: "center", h_offset: 10, v_offset: 0 }, right: { h_align: "right", v_align: "center", h_offset: 10, v_offset: 0 } }, }, responsivelevels:[2540,1280,975,991,767,479], gridwidth:[1320,1170,975,750,480,450], gridheight:[800,800,650,500,500,500], shadow:0, spinner:"off", autoheight:"off", disableprogressbar:"on", hidethumbsonmobile:"off", hideslideratlimit:0, hidecaptionatlimit:0, hideallcaptionatlilmit:0, debugmode:false, fallbacks: { simplifyall:"off", disablefocuslistener:false, } }); }; } // =3. theme dropdwon function dropdown () { if ($(".dropdown-menu li").length) { $(".dropdown-menu li").on('click', function(){ $(this).parents(".dropdown").find('.btn-dropdown').html($(this).text() + ' '); $(this).parents(".dropdown").find('.btn-dropdown').val($(this).data('value')); }); }; } // =3. mainmenu submenu toggler function mainmenusubmenutoggler () { if ($('.main_menu nav ul li.sub_dropdown').length) { $('.main_menu nav ul li.sub_dropdown').append(function () { return ''; }); $('.main_menu nav ul li.sub_dropdown .fa').on('click', function () { $(this).parent('li').children('ul').slidetoggle(); }); }; } // =4. theme carousel function thmcarousel () { if ($("#owl-demo").length) { var owl = $("#owl-demo"); owl.owlcarousel({ items : 2, itemsdesktop : [992,2], itemsdesktopsmall : [768,1], itemstablet: [450,1], itemsmobile : false,// itemsmobile disabled - inherit from itemstablet option pagination : false, autoplay:4000 }); // custom navigation events $(".next").on('click', function(){ owl.trigger('owl.next'); }); $(".prev").on('click', function(){ owl.trigger('owl.prev'); }); }; } // =5. shop price ranger function priceranger () { if ($('.price-ranger').length) { $( '.price-ranger #slider-range' ).slider({ range: true, min: 0, max: 1200, values: [ 99, 1035 ], slide: function( event, ui ) { $( '.price-ranger .ranger-min-max-block .min' ).val( '$' + ui.values[ 0 ] ); $( '.price-ranger .ranger-min-max-block .max' ).val( '$' + ui.values[ 1 ] ); } }); $( '.price-ranger .ranger-min-max-block .min' ).val( '$' + $( '.price-ranger #slider-range' ).slider( 'values', 0 ) ); $( '.price-ranger .ranger-min-max-block .max' ).val( '$' + $( '.price-ranger #slider-range' ).slider( 'values', 1 ) ); }; } // =6 google map /*function googlemap () { if ($('#contact-google-map').length) { var settingsitemsmap = { zoom: 12, center: new google.maps.latlng(40.758896, -73.985130), zoomcontroloptions: { style: google.maps.zoomcontrolstyle.large }, scrollwheel: false, styles:[ { featuretype: "water", stylers: [ { color: "#c0d887"} ] }, { featuretype: "road", stylers: [ { color: "#f2f2f2" } ] } ], maptypeid: google.maps.maptypeid.roadmap }; var map = new google.maps.map(document.getelementbyid('contact-google-map'), settingsitemsmap ); var image = 'images/home/map-icon.png'; var mymarker = new google.maps.marker({ position: new google.maps.latlng(40.758896, -73.985130), draggable: true, icon: image }); map.setcenter(mymarker.position); mymarker.setmap(map); // google map }; } */ // =7. theme accrodion function thnaccordion () { if ( $('#accordion > .panel').length || $('#accordion_two > .panel').length ) { $('#accordion > .panel').on('show.bs.collapse', function (e) { var heading = $(this).find('.panel-heading'); heading.addclass("active-panel"); }); $('#accordion > .panel').on('hidden.bs.collapse', function (e) { var heading = $(this).find('.panel-heading'); heading.removeclass("active-panel"); //setprogressbar(heading.get(0).id); }); $('#accordion_two > .panel').on('show.bs.collapse', function (e) { var heading = $(this).find('.panel-heading'); heading.addclass("active-panel"); }); $('#accordion_two > .panel').on('hidden.bs.collapse', function (e) { var heading = $(this).find('.panel-heading'); heading.removeclass("active-panel"); //setprogressbar(heading.get(0).id); }); }; } // =8. theme skin switcher function thmskinswitcher () { if ($('.switch_btn button').length) { $('.switch_btn button').on('click', function(){ $('.switch_menu').toggle(300) }); $("#boxed").on('click', function(){ $(".layout_changer").addclass("home_boxed"); }); $("#full_width").on('click', function(){ $(".layout_changer").removeclass("home_boxed"); }); $(".bg1").on('click', function(){ $(".home_boxed").addclass("bg1"); $(".home_boxed").removeclass("bg2 bg3 bg4"); }); $(".bg2").on('click', function(){ $(".home_boxed").addclass("bg2"); $(".home_boxed").removeclass("bg1 bg3 bg4"); }); $(".bg3").on('click', function(){ $(".home_boxed").addclass("bg3"); $(".home_boxed").removeclass("bg2 bg1 bg4"); }); $(".bg4").on('click', function(){ $(".home_boxed").addclass("bg4"); $(".home_boxed").removeclass("bg2 bg3 bg1"); }); $("#myonoffswitch").on('click', function(){ $(".main_menu").toggleclass("menu_fixed"); $(".main_menu").removeclass("fixed"); }); }; } // =9. main menu sticky function menusticky () { if ($('.menu_fixed.main_menu').length) { var sticky = $('.menu_fixed.main_menu'), scroll = $(window).scrolltop(); if (scroll >= 190) sticky.addclass('fixed'); else sticky.removeclass('fixed'); }; } // =10. theme lightbox active function thmlightbox () { if ($(".fancybox").length) { $(".fancybox").fancybox({ helpers : { overlay : { css : { 'background' : 'rgba(0,0,0,0.7)' } } } }); }; } // =11. theme gallery filter function thmgallyersorter () { if ($('#mixitup_list').length) { $('#mixitup_list').mixitup(); // mix it up }; } // select menu function selectdropdown () { if($(".selectmenu").length) { $( ".selectmenu" ).selectmenu(); }; } //contact form validation function contactformvalidation () { if($('.contact-form').length){ $('.contact-form').validate({ // initialize the plugin rules: { fname: { required: true }, lname: { required: true }, email: { required: true, email: true }, city: { required: true }, phone: { required: true }, zip: { required: true }, message: { required: true }, subject: { required: true } }, submithandler: function (form) { // sending value with ajax request $.post($(form).attr('action'), $(form).serialize(), function (response) { $(form).parent('div').append(response); $(form).find('input[type="text"]').val(''); $(form).find('input[type="email"]').val(''); $(form).find('textarea').val(''); }); return false; } }); } } // document ready event jquery(document).on('ready', function() { (function ($) { mainmenusubmenutoggler(); dropdown(); thmrevslider(); thmcarousel(); priceranger(); /*googlemap();*/ thnaccordion(); thmskinswitcher(); counterup(); thmlightbox(); thmgallyersorter(); selectdropdown(); contactformvalidation(); })(jquery); }); // window sccroll event jquery(window).on('scroll', function() { (function ($) { menusticky(); })(jquery); });