/* ===================================================== Template Name : Loveo Description : Wedding And Wedding Planner HTML5 Template Author : LunarTemp Version : 1.0 =======================================================*/ (function ($) { "use strict"; // multi level dropdown menu $('.dropdown-menu a.dropdown-toggle').on('click', function (e) { if (!$(this).next().hasClass('show')) { $(this).parents('.dropdown-menu').first().find('.show').removeClass('show'); } var $subMenu = $(this).next('.dropdown-menu'); $subMenu.toggleClass('show'); $(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function (e) { $('.dropdown-submenu .show').removeClass('show'); }); return false; }); //Header Search if ($('.search-box-outer').length) { $('.search-box-outer').on('click', function () { $('body').addClass('search-active'); }); $('.close-search').on('click', function () { $('body').removeClass('search-active'); }); } // data-background $(document).on('ready', function () { $("[data-background]").each(function () { $(this).css("background-image", "url(" + $(this).attr("data-background") + ")"); }); }); // wow init new WOW().init(); // hero slider $('.hero-slider').owlCarousel({ loop: true, nav: true, dots: false, margin: 0, autoplay: true, autoplayHoverPause: true, autoplayTimeout: 5000, items: 1, navText: [ "", "" ], onInitialized: function(event) { var $firstAnimatingElements = $('.owl-item').eq(event.item.index).find("[data-animation]"); doAnimations($firstAnimatingElements); }, onChanged: function(event){ var $firstAnimatingElements = $('.owl-item').eq(event.item.index).find("[data-animation]"); doAnimations($firstAnimatingElements); } }); //hero slider do animations function doAnimations(elements) { var animationEndEvents = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'; elements.each(function () { var $this = $(this); var $animationDelay = $this.data('delay'); var $animationDuration = $this.data('duration'); var $animationType = 'animated ' + $this.data('animation'); $this.css({ 'animation-delay': $animationDelay, '-webkit-animation-delay': $animationDelay, 'animation-duration': $animationDuration, '-webkit-animation-duration': $animationDuration, }); $this.addClass($animationType).one(animationEndEvents, function () { $this.removeClass($animationType); }); }); } // partner-slider $('.partner-slider').owlCarousel({ loop: true, margin: 40, nav: false, dots: false, autoplay: true, responsive: { 0: { items: 2 }, 600: { items: 3 }, 1000: { items: 6 } } }); // testimonial-slider $('.testimonial-slider').owlCarousel({ loop: true, margin: 30, nav: false, dots: true, autoplay: true, responsive: { 0: { items: 1 }, 600: { items: 2 }, 1000: { items: 2 } } }); // service-slider $('.service-slider').owlCarousel({ loop: true, margin: 20, nav: false, dots: true, navText: [ "", "" ], autoplay: true, responsive: { 0: { items: 1 }, 600: { items: 2 }, 1000: { items: 3 } } }); // portfolio-slider $('.portfolio-slider').owlCarousel({ loop: true, margin: 20, nav: false, dots: true, navText: [ "", "" ], autoplay: true, responsive: { 0: { items: 1 }, 600: { items: 2 }, 1000: { items: 3 } } }); // instagram-slider $('.instagram-slider').owlCarousel({ loop: true, margin: 0, nav: false, dots: false, center: true, autoplay: true, responsive: { 0: { items: 2 }, 600: { items: 3 }, 1000: { items: 6 } } }); // preloader $(window).on('load', function () { $(".preloader").fadeOut("slow"); }); // fun fact counter $('.counter').countTo(); $('.counter-box').appear(function () { $('.counter').countTo(); }, { accY: -100 }); // progress bar $(document).ready(function(){ var progressBar = $('.progress'); if(progressBar.length) { progressBar.each(function () { var Self = $(this); Self.appear(function () { var progressValue = Self.data('value'); Self.find('.progress-bar').animate({ width:progressValue+'%' }, 1000); }); }) } }); // magnific popup init $(".popup-gallery").magnificPopup({ delegate: '.popup-img', type: 'image', gallery: { enabled: true }, }); $(".popup-youtube, .popup-vimeo, .popup-gmaps").magnificPopup({ type: "iframe", mainClass: "mfp-fade", removalDelay: 160, preloader: false, fixedContentPos: false }); // scroll to top $(window).scroll(function () { if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) { $("#scroll-top").fadeIn('slow'); } else { $("#scroll-top").fadeOut('slow'); } }); $("#scroll-top").click(function () { $("html, body").animate({ scrollTop: 0 }, 1500); return false; }); $(window).scroll(function () { if ($(this).scrollTop() > 50) { $('.navbar').addClass("fixed-top"); } else { $('.navbar').removeClass("fixed-top"); } }); // wedding countdown if ($('#wedding-countdown').length) { $('#wedding-countdown').countdown('2030/01/30', function (event) { $(this).html(event.strftime('' + '
' + '
' + '

%-D

' + '
Day%!d
' + '
' + '
' + '

%H

' + '
Hours
' + '
' + '
' + '

%M

' + '
Minutes
' + '
' + '
' + '

%S

' + '
Seconds
' + '
' + '
')); }); } // coming soon countdown if ($('#countdown').length) { $('#countdown').countdown('2030/01/30', function (event) { $(this).html(event.strftime('' + '
' + '
' + '

%-D

' + '
Day%!d
' + '
' + '
' + '

%H

' + '
Hours
' + '
' + '
' + '

%M

' + '
Minutes
' + '
' + '
' + '

%S

' + '
Seconds
' + '
' + '
')); }); } // project filter $(window).on('load', function () { if ($(".filter-box").children().length > 0) { $(".filter-box").isotope({ itemSelector: '.filter-item', masonry: { columnWidth: 1 }, }); $('.filter-btns').on('click', 'li', function () { var filterValue = $(this).attr('data-filter'); $(".filter-box").isotope({ filter: filterValue }); }); $(".filter-btns li").each(function () { $(this).on("click", function () { $(this).siblings("li.active").removeClass("active"); $(this).addClass("active"); }); }); } }); // copywrite date let date = new Date().getFullYear(); $("#date").html(date); // price range slider if($(".price-range").length){ $( ".price-range" ).slider({ range: true, min: 0, max: 999, values: [ 100, 500 ], slide: function( event, ui ){$( "#price-amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );} }); $( "#price-amount" ).val( "$" + $( ".price-range" ).slider( "values", 0 ) + " - $" + $( ".price-range" ).slider( "values", 1 ) ); } //cart quantity $(".plus-btn").on("click", function () { var i = $(this).closest(".cart-qty").children(".quantity").get(0).value++, c = $(this).closest(".cart-qty").children(".minus-btn"); i > 0 && c.removeAttr("disabled"); }), $(".minus-btn").on("click", function () { 2 == $(this).closest(".cart-qty").children(".quantity").get(0).value-- && $(this).attr("disabled", "disabled"); }) // flexslider if ($('.flexslider-thumbnails').length) { $('.flexslider-thumbnails').flexslider({ animation: "slide", controlNav: "thumbnails", }); } })(jQuery);