/*************************************************************************************************************** |||||||||||||||||||||||||||| custom script for repairplus |||||||||||||||||||||||||||||||||||||| **************************************************************************************************************** |||||||||||||||||||||||||||| table of content |||||||||||||||||||||||||||||||||||| **************************************************************************************************************** **************************************************************************************************************** 01. revolution slider 02. sticky header 03. prealoader 04. language switcher 05. prettyphoto 06. brandcarousel 07. testimonial carousel 08. scrolltotop 09. cart touch spin 10. pricefilter 11. cart touch spin 12. fancybox activator 13. contactformvalidation 14. scoll to target 15. prettyphoto **************************************************************************************************************** |||||||||||||||||||||||||||| end table of content |||||||||||||||||||||||||||||||||||| ****************************************************************************************************************/ "use strict"; //===revolutionslideractiver=== function revolutionslideractiver () { if ($('.rev_slider_wrapper #slider1').length) { $("#slider1").revolution({ slidertype:"standard", sliderlayout:"auto", delay:5000, navigationtype:"bullet", navigationarrows:"0", navigationstyle:"preview3", dottedoverlay:'yes', hidetimerbar:"off", onhoverstop:"off", navigation: { arrows:{enable:true} }, gridwidth: [1200, 940, 720, 480], gridheight: [540, 550, 550, 500] }); }; } //====main menu=== function mainmenu() { //submenu dropdown toggle if($('.main-menu li.dropdown ul').length){ $('.main-menu li.dropdown').append(''); //dropdown button $('.main-menu li.dropdown .dropdown-btn').on('click', function() { $(this).prev('ul').slidetoggle(500); }); } } //===header sticky=== function stickyheader() { if ($('.stricky').length) { var strickyscrollpos = 100; if ($(window).scrolltop() > strickyscrollpos) { $('.stricky').addclass('stricky-fixed'); $('.scroll-to-top').fadein(1500); } else if ($(this).scrolltop() <= strickyscrollpos) { $('.stricky').removeclass('stricky-fixed'); $('.scroll-to-top').fadeout(1500); } }; } // scoll to top function scrolltotop() { if ($('.scroll-to-target').length) { $(".scroll-to-target").on('click', function() { var target = $(this).attr('data-target'); // animate $('html, body').animate({ scrolltop: $(target).offset().top }, 1000); }); } } // ===prealoder=== function prealoader() { if($('.preloader').length){ $('.preloader').delay(2000).fadeout(500); } } //===language switcher=== function languageswitcher() { if ($("#polyglot-language-options").length) { $('#polyglotlanguageswitcher').polyglotlanguageswitcher({ effect: 'fade', testmode: true, onchange: function(evt) { alert("the selected language is: " + evt.selecteditem); } // ,afterload: function(evt){ // alert("the selected language has been loaded"); // }, // beforeopen: function(evt){ // alert("before open"); // }, // afteropen: function(evt){ // alert("after open"); // }, // beforeclose: function(evt){ // alert("before close"); // }, // afterclose: function(evt){ // alert("after close"); // } }); }; } //===prettyphoto lightbox=== function prettyphoto() { $("a[data-rel^='prettyphoto']").prettyphoto({ animation_speed:'normal', slideshow:3000, autoplay_slideshow: false, fullscreen: true, social_tools: false }); } //===brand carousel=== function brandcarousel () { if ($('.brand').length) { $('.brand').owlcarousel({ dots: false, loop:true, margin:30, nav:true, navtext: [ '', '' ], autoplayhoverpause: false, autoplay: 6000, smartspeed: 1000, responsive:{ 0:{ items:1 }, 600:{ items:2 }, 800:{ items:3 }, 1024:{ items:4 }, 1100:{ items:4 }, 1200:{ items:5 } } }); } } //===testimonial slider=== function testimonialslider() { if ($('.testimonial-carousel').length) { $('.testimonial-carousel').owlcarousel({ loop:true, margin:30, nav:true, dots: false, autoplayhoverpause:false, autoplay: 6000, smartspeed: 700, navtext: [ '', '' ], responsive:{ 0:{ items:1 }, 600:{ items:1 }, 800:{ items:2 }, 1024:{ items:2 }, 1100:{ items:3 }, 1200:{ items:3 } } }) } } // fact counter function counternumberchanger () { var timer = $('.timer'); if(timer.length) { timer.appear(function () { timer.countto(); }) } } //accordion box function accordion() { if($('.accordion-box').length){ $(".accordion-box").on('click', '.accord-btn', function() { if($(this).hasclass('active')!==true){ $('.accordion .accord-btn').removeclass('active'); } if ($(this).next('.accord-content').is(':visible')){ $(this).removeclass('active'); $(this).next('.accord-content').slideup(500); }else{ $(this).addclass('active'); $('.accordion .accord-content').slideup(500); $(this).next('.accord-content').slidedown(500); } }); } } // cart touch spin function carttouchspin() { if ($('.quantity-spinner').length) { $("input.quantity-spinner").touchspin({ verticalbuttons: true }); } } // select menu function selectdropdown () { if($(".selectmenu").length) { $( ".selectmenu" ).selectmenu(); }; } // price filter function pricefilter() { if ($('.price-ranger').length) { $('.price-ranger #slider-range').slider({ range: true, min: 10, max: 200, values: [11, 99], 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)); }; } // date picker function datepicker () { if ($('#datepicker').length) { $('#datepicker').datepicker(); }; } // time picker function timepicker () { $('input[name="time"]').pttimeselect(); } //contact form validation if($("#contact-form").length){ $("#contact-form").validate({ submithandler: function(form) { var form_btn = $(form).find('button[type="submit"]'); var form_result_div = '#form-result'; $(form_result_div).remove(); form_btn.before(''); var form_btn_old_msg = form_btn.html(); form_btn.html(form_btn.prop('disabled', true).data("loading-text")); $(form).ajaxsubmit({ datatype: 'json', success: function(data) { if( data.status = 'true' ) { $(form).find('.form-control').val(''); } form_btn.prop('disabled', false).html(form_btn_old_msg); $(form_result_div).html(data.message).fadein('slow'); settimeout(function(){ $(form_result_div).fadeout('slow') }, 6000); } }); } }); } // dom ready function jquery(document).on('ready', function () { (function ($) { // add your functions revolutionslideractiver (); mainmenu (); languageswitcher (); brandcarousel (); testimonialslider (); scrolltotop (); prettyphoto (); counternumberchanger (); accordion (); carttouchspin (); selectdropdown (); pricefilter (); datepicker (); timepicker () })(jquery); }); jquery(window).on('scroll', function(){ (function ($) { stickyheader() })(jquery); }); // instance of fuction while window load event jquery(window).on('load', function() { (function($) { prealoader () })(jquery); });