/* * Theme functions js file. * * @package anirohotellight */ (function ($) { "use strict"; $(document).ready(function () { //Blazy var imagesToLoad = document.querySelectorAll('.b-lazy'); var blazy = new Blazy(); blazy.load(imagesToLoad); //**************************************************************************** //Gallery //**************************************************************************** $('.gallery').each(function () { $(this).magnificPopup({ delegate: 'a', type: 'image', tLoading: 'Loading image #%curr%...', mainClass: 'mfp-img-mobile', gallery: { enabled: true, navigateByImgClick: true, preload: [0, 1] // Will preload 0 - before current, and 1 after the current image }, image: { tError: 'The image #%curr% could not be loaded.', titleSrc: function (item) { return item.img.attr('alt'); } } }); }); //**************************************************************************** //Main slider type1 - slick //**************************************************************************** $(".mainslider-type11").slick({ lazyLoad: 'ondemand', dots: false, infinite: true, speed: 300, autoplay: true, autoplaySpeed: 3000, slidesToShow: 1, slidesToScroll: 1, arrows: true, nextArrow: "
", prevArrow: "
" }); //**************************************************************************** //Main slider type2 - slick //**************************************************************************** $(".mainslider-type22").slick({ lazyLoad: 'ondemand', dots: false, infinite: true, speed: 300, fade: true, cssEase: 'linear', slidesToShow: 1, slidesToScroll: 1, autoplay: true, autoplaySpeed: 3000, arrows: true, nextArrow: "
", prevArrow: "
" }); //**************************************************************************** //Slider on page-template About - slick //**************************************************************************** $(".about-slider").slick({ dots: false, infinite: true, speed: 300, slidesToShow: 2, slidesToScroll: 1, arrows: true, nextArrow: "
", prevArrow: "
", responsive: [ { breakpoint: 460, settings: { slidesToShow: 1, slidesToScroll: 1 } } ] }); //**************************************************************************** //Modal window for search //**************************************************************************** $('.popup-with-form').magnificPopup({ type: 'inline', preloader: false, focus: '.search-field', // When elemened is focused, some mobile browsers in some cases zoom in // It looks not nice, so we disable it: callbacks: { beforeOpen: function () { if ($(window).width() < 700) { this.st.focus = false; } else { this.st.focus = '.search-field'; } } } }); //**************************************************************************** //Go to top //**************************************************************************** $(window).scroll(function() { if($(this).scrollTop() > 100) { $('#gototop').fadeIn('slow'); $("#gototop").show(); } else { $('#gototop').fadeOut('slow'); $("#gototop").hide(); } }); $('#gototop').click(function() { $('body,html').animate({ scrollTop: 0 }, 800); return false; }); //**************************************************************************** //Slider on page-template About - slick //**************************************************************************** $(".about-slider").slick({ dots: false, infinite: true, speed: 300, slidesToShow: 2, slidesToScroll: 1, arrows: true, nextArrow: "
", prevArrow: "
", responsive: [ { breakpoint: 460, settings: { slidesToShow: 1, slidesToScroll: 1 } } ] }); //**************************************************************************** //Slider on Post Format - Room //**************************************************************************** $(".room-slider").slick({ dots: false, infinite: true, speed: 300, slidesToShow: 1, slidesToScroll: 1, arrows: true, nextArrow: "
", prevArrow: "
" }); //**************************************************************************** //Add animation for text in slider //**************************************************************************** var boxtext11 = $('.mainslider-type11 .slidertxt'); var boxlink11 = $('.mainslider-type11 .slider-link'); boxtext11.addClass("animated fadeInDownBig"); boxlink11.addClass("animated fadeInUpBig"); $('.mainslider-type11').on('beforeChange', function (event, slick, direction) { boxtext11.removeClass('fadeInDownBig'); boxlink11.removeClass("fadeInUpBig"); setTimeout(function () { boxtext11.addClass('fadeInDownBig'); boxlink11.addClass('fadeInUpBig'); }, 100); blazy.revalidate(); }); var boxtext22 = $('.mainslider-type22 .slidertxt'); var boxlink22 = $('.mainslider-type22 .slider-link'); boxtext22.addClass("animated fadeInLeftBig"); boxlink22.addClass("animated fadeInRightBig"); $('.mainslider-type22').on('beforeChange', function (event, slick, direction) { boxtext22.removeClass('fadeInLeftBig'); boxlink22.removeClass("fadeInRightBig"); setTimeout(function () { boxtext22.addClass('fadeInLeftBig'); boxlink22.addClass('fadeInRightBig'); }, 100); blazy.revalidate(); }); //**************************************************************************** // add wow.js // find browser - if browser is IE11 - do not use wow.js //**************************************************************************** var userAgent; userAgent=navigator.userAgent; var browser='Trident'; var isbrowser; isbrowser=userAgent.indexOf(browser); //-1 - not found if (isbrowser === -1) { var wow = new WOW( { mobile: false } ); wow.init(); } //**************************************************************************** // Show FAQ //**************************************************************************** $('.faq_question').click(function () { if ($(this).parent().is('.open')) { $(this).closest('.faq').find('.faq_answer_container').animate({'height': '0'}, 500); $(this).closest('.faq').removeClass('open'); $(this).parent().find('.accordion-button-icon').removeClass('fa-minus').addClass('fa-plus'); } else { var newHeight = $(this).closest('.faq').find('.faq_answer').height() + 'px'; $(this).closest('.faq').find('.faq_answer_container').animate({'height': newHeight}, 500); $(this).closest('.faq').addClass('open'); $(this).parent().find('.accordion-button-icon').removeClass('fa-plus').addClass('fa-minus'); } }); //**************************************************************************** //Services - slick //**************************************************************************** $(".services-container").slick({ dots: true, infinite: true, speed: 300, slidesToShow: 3, slidesToScroll: 3, arrows: false, nextArrow: "
", prevArrow: "
", responsive: [ { breakpoint: 900, settings: { slidesToShow: 2, slidesToScroll: 2 } }, { breakpoint: 450, settings: { dots: false, slidesToShow: 1, slidesToScroll: 1 } } ] }); $(".testimonial-container").slick({ dots: true, infinite: true, speed: 300, slidesToShow: 2, slidesToScroll: 2, arrows: false, nextArrow: "
", prevArrow: "
", responsive: [ { breakpoint: 900, settings: { slidesToShow: 1, slidesToScroll: 1 } }, { breakpoint: 450, settings: { dots: false, slidesToShow: 1, slidesToScroll: 1 } } ] }); }); })(jQuery);