(function ($) { "use strict"; $(function () { /* ---------------------------------------------------- */ /* Gallery carousel */ /* ---------------------------------------------------- */ $.mad_global.mad_init_carousel(); /* ---------------------------------------------------- */ /* Tabs */ /* ---------------------------------------------------- */ var tabs = $('.tabs-section'); if (tabs.length) { tabs.tabs({ beforeActivate: function (event, ui) { var hash = ui.newTab.children("li a").attr("href"); }, hide: { effect: "fadeOut", duration: 450 }, show: { effect: "fadeIn", duration: 450 }, updateHash: false }); } if ($('ul.smooth_tabs').length) { $('ul.smooth_tabs li:first').addClass('ui-tabs-active'); $('ul.smooth_tabs li a').on("click", function () { $('ul.smooth_tabs').find('li').removeClass('ui-tabs-active'); $(this).parent('li').addClass("ui-tabs-active"); var x = $(this).attr('href'); $(".smooth_item").removeClass('current_catalog_item'); $(".tabs_content ").children('h3').removeClass('current_catalog_item'); $(x).addClass('current_catalog_item'); }); } /* ---------------------------------------------------- */ /* Loader */ /* ---------------------------------------------------- */ $("body").queryLoader2({ backgroundColor: '#fff', barColor: '#ff0600', barHeight: 4, deepSearch: true, minimumTime: 1000, onComplete: function () { $(".loader").fadeOut('200'); } }); /* ---------------------------------------------------- */ /* Sticky menu */ /* ---------------------------------------------------- */ $('body').Temp({ sticky: true }); /* ---------------------------------------------------- */ /* SmoothScroll */ /* ---------------------------------------------------- */ try { $.browserSelector(); var $html = $('html'); if ($html.hasClass('chrome') || $html.hasClass('ie11') || $html.hasClass('ie10')) { $.smoothScroll(); } } catch (err) {} // fancybox if ($('a.gallery').length) { $('a.gallery').fancybox(); } if ($('a.video').length) { $("a.video").on("click", function () { $.fancybox({ href: this.href, type: $(this).data("type") }); // fancybox return false; }); // on } /* ---------------------------------------------------- */ /* Custom Select */ /* ---------------------------------------------------- */ if ($('.custom-select').length) { $('.custom-select').mad_custom_select(); } /* ---------------------------------------------------- */ /* Accordion & Toggle */ /* ---------------------------------------------------- */ var aItem = $('.accordion:not(.toggle) .accordion-item'), link = aItem.find('.a-title'), $label = aItem.find('label'), aToggleItem = $('.accordion.toggle .accordion-item'), tLink = aToggleItem.find('.a-title'); aItem.add(aToggleItem).children('.a-title').not('.active').next().hide(); function triggerAccordeon($item) { $item .addClass('active') .next().stop().slideDown() .parent().siblings() .children('.a-title') .removeClass('active') .next().stop().slideUp(); } if ($label.length) { $label.on('click', function () { triggerAccordeon($(this).closest('.a-title')) }); } else { link.on('click', function () { triggerAccordeon($(this)) }); } tLink.on('click', function () { $(this).toggleClass('active') .next().stop().slideToggle(); }) /* ---------------------------------------------------- */ /* Contact Form */ /* ---------------------------------------------------- */ if ($('#contact-form').length) { var cf = $('#contact-form'); cf.append('
'); cf.on("submit", function (event) { var self = $(this), text; var request = $.ajax({ url: "bat/mail.php", type: "post", data: self.serialize() }); request.then(function (data) { if (data == "1") { text = "Your message has been sent successfully!"; cf.find('input:not([type="submit"]),textarea').val(''); $('.message-container').html('

' + text + '

') .delay(150) .slideDown(300) .delay(4000) .slideUp(300, function () { $(this).html(""); }); } else { if (cf.find('textarea').val().length < 20) { text = "Message must contain at least 20 characters!" } if (cf.find('input').val() == "") { text = "All required fields must be filled!"; } $('.message-container').html('

' + text + '

') .delay(150) .slideDown(300) .delay(4000) .slideUp(300, function () { $(this).html(""); }); } }, function () { $('.message-container').html('

Connection to server failed!

') .delay(150) .slideDown(300) .delay(4000) .slideUp(300, function () { $(this).html(""); }); }); event.preventDefault(); }); } /* ---------------------------------------------------- */ /* Main elements run */ /* ---------------------------------------------------- */ // $.mad_core.run(); }); /* ---------------------------------------------------- blog masonary /* ---------------------------------------------------- */ $(window).on('load', function () { if ($('.blog-masonary').length) { $('.blog-masonary').isotope({ itemSelector: '.mas-item', masonry: { columnWidth: '.mas-item' } }); }; }); })(jQuery);