PageSourceSearch

https://hotelackas.fi/assets/js/script.js

js hotelackas.fi collected 2026-10-02 00:20:48 UTC 18,759 bytes, 698 lines download raw bytes

1(function ($) {
2  'use strict';
3
4  $(document).ready(function () {
5    // Disable all form event listeners
6    $('form').off();
7  });
8
9  $('.select').niceSelect();
10
11  $('.input-group.date').datepicker({ format: 'dd.mm.yyyy' });
12
13  /*------------------------------------------
14        = ALL ESSENTIAL FUNCTIONS
15    -------------------------------------------*/
16
17  // Toggle mobile navigation
18  function toggleMobileNavigation() {
19    var navbar = $('.navigation-holder');
20    var openBtn = $('.navbar-header .open-btn');
21    var closeBtn = $('.navigation-holder .close-navbar');
22    var body = $('.page-wrapper');
23
24    openBtn.on('click', function () {
25      if (!navbar.hasClass('slideInn')) {
26        navbar.addClass('slideInn');
27        body.addClass('body-overlay');
28      }
29      return false;
30    });
31
32    closeBtn.on('click', function () {
33      if (navbar.hasClass('slideInn')) {
34        navbar.removeClass('slideInn');
35      }
36      body.removeClass('body-overlay');
37      return false;
38    });
39  }
40
41  toggleMobileNavigation();
42
43  // Function for toggle class for small menu
44  function toggleClassForSmallNav() {
45    var windowWidth = window.innerWidth;
46    var mainNav = $('#navbar > ul');
47
48    if (windowWidth <= 991) {
49      mainNav.addClass('small-nav');
50    } else {
51      mainNav.removeClass('small-nav');
52    }
53  }
54
55  toggleClassForSmallNav();
56
57  // Function for small menu
58  function smallNavFunctionality() {
59    var windowWidth = window.innerWidth;
60    var mainNav = $('.navigation-holder');
61    var smallNav = $('.navigation-holder > .small-nav');
62    var subMenu = smallNav.find('.sub-menu');
63    var megamenu = smallNav.find('.mega-menu');
64    var menuItemWidthSubMenu = smallNav.find('.menu-item-has-children > a');
65
66    if (windowWidth <= 991) {
67      subMenu.hide();
68      megamenu.hide();
69      menuItemWidthSubMenu.on('click', function (e) {
70        var $this = $(this);
71        $this.siblings().slideToggle();
72        e.preventDefault();
73        e.stopImmediatePropagation();
74      });
75    } else if (windowWidth > 991) {
76      mainNav.find('.sub-menu').show();
77      mainNav.find('.mega-menu').show();
78    }
79  }
80
81  smallNavFunctionality();
82
83  // smooth-scrolling
84  function smoothScrolling($scrollLinks, $topOffset) {
85    var links = $scrollLinks;
86    var topGap = $topOffset;
87
88    links.on('click', function () {
89      if (
90        location.pathname.replace(/^\//, '') ===
91          this.pathname.replace(/^\//, '') &&
92        location.hostname === this.hostname
93      ) {
94        var target = $(this.hash);
95        target = target.length
96          ? target
97          : $('[name=' + this.hash.slice(1) + ']');
98        if (target.length) {
99          $('html, body').animate(
100            {
101              scrollTop: target.offset().top - topGap,
102            },
103            1000,
104            'easeInOutExpo'
105          );
106          return false;
107        }
108      }
109      return false;
110    });
111  }
112
113  // Parallax background
114  function bgParallax() {
115    if ($('.parallax').length) {
116      $('.parallax').each(function () {
117        var height = $(this).position().top;
118        var resize = height - $(window).scrollTop();
119        var parallaxSpeed = $(this).data('speed');
120        var doParallax = -(resize / parallaxSpeed);
121        var positionValue = doParallax + 'px';
122        var img = $(this).data('bg-image');
123
124        $(this).css({
125          backgroundImage: 'url(' + img + ')',
126          backgroundPosition: '50%' + positionValue,
127          backgroundSize: 'cover',
128        });
129
130        if (window.innerWidth < 768) {
131          $(this).css({
132            backgroundPosition: 'center center',
133          });
134        }
135      });
136    }
137  }
138
139  bgParallax();
140
141  // Hero slider background setting
142  function sliderBgSetting() {
143    if ($('.hero-slider .slide').length) {
144      $('.hero-slider .slide').each(function () {
145        var $this = $(this);
146        var img = $this.find('.slider-bg').attr('src');
147
148        $this.css({
149          backgroundImage: 'url(' + img + ')',
150          backgroundSize: 'cover',
151          backgroundPosition: 'center center',
152        });
153      });
154    }
155  }
156
157  //Setting hero slider
158  function heroSlider() {
159    if ($('.hero-slider').length) {
160      $('.hero-slider').slick({
161        autoplay: true,
162        autoplaySpeed: 8000,
163        arrows: true,
164        prevArrow: '<button type="button" class="slick-prev">Previous</button>',
165        nextArrow: '<button type="button" class="slick-next">Next</button>',
166        dots: true,
167        fade: true,
168        cssEase: 'linear',
169      });
170    }
171  }
172
173  //Active heor slider
174  heroSlider();
175
176  function popupSaveTheDateCircle() {
177    var saveTheDateCircle = $('.save-the-date');
178    saveTheDateCircle.addClass('popup-save-the-date');
179  }
180
181  /*------------------------------------------
182        = POST SLIDER
183    -------------------------------------------*/
184  if ($('.post-slider'.length)) {
185    $('.post-slider').owlCarousel({
186      mouseDrag: false,
187      smartSpeed: 500,
188      margin: 30,
189      loop: true,
190      nav: true,
191      navText: [
192        '<i class="fi ti-angle-left"></i>',
193        '<i class="fi ti-angle-right"></i>',
194      ],
195      dots: false,
196      items: 1,
197    });
198  }
199
200  /*------------------------------------------
201        = HIDE PRELOADER
202    -------------------------------------------*/
203  function preloader() {
204    if ($('.preloader').length) {
205      $('.preloader')
206        .delay(100)
207        .fadeOut(500, function () {
208          //active wow
209          wow.init();
210        });
211    }
212  }
213
214  /*------------------------------------------
215        = WOW ANIMATION SETTING
216    -------------------------------------------*/
217  var wow = new WOW({
218    boxClass: 'wow', // default
219    animateClass: 'animated', // default
220    offset: 0, // default
221    mobile: true, // default
222    live: true, // default
223  });
224
225  /*------------------------------------------
226        = ACTIVE POPUP IMAGE
227    -------------------------------------------*/
228  if ($('.fancybox').length) {
229    $('.fancybox').fancybox({
230      openEffect: 'elastic',
231      closeEffect: 'elastic',
232      wrapCSS: 'project-fancybox-title-style',
233    });
234  }
235
236  /*------------------------------------------
237        = POPUP VIDEO
238    -------------------------------------------*/
239  if ($('.video-btn').length) {
240    $('.video-btn').on('click', function () {
241      $.fancybox({
242        href: this.href,
243        type: $(this).data('type'),
244        title: this.title,
245        helpers: {
246          title: { type: 'inside' },
247          media: {},
248        },
249
250        beforeShow: function () {
251          $('.fancybox-wrap').addClass('gallery-fancybox');
252        },
253      });
254      return false;
255    });
256  }
257
258  /*------------------------------------------
259        = POPUP YOUTUBE, VIMEO, GMAPS
260    -------------------------------------------*/
261  $('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
262    type: 'iframe',
263    mainClass: 'mfp-fade',
264    removalDelay: 160,
265    preloader: false,
266    fixedContentPos: false,
267  });
268
269  /*------------------------------------------
270        = ACTIVE POPUP IMAGE
271    -------------------------------------------*/
272  if ($('.popup-image').length) {
273    $('.popup-image').magnificPopup({
274      type: 'image',
275      zoom: {
276        enabled: true,
277
278        duration: 300,
279        easing: 'ease-in-out',
280        opener: function (openerElement) {
281          return openerElement.is('img')
282            ? openerElement
283            : openerElement.find('img');
284        },
285      },
286    });
287  }
288
289  /*------------------------------------------
290        = ACTIVE GALLERY POPUP IMAGE
291    -------------------------------------------*/
292  if ($('.popup-gallery').length) {
293    $('.popup-gallery').magnificPopup({
294      delegate: 'a',
295      type: 'image',
296
297      gallery: {
298        enabled: true,
299      },
300
301      zoom: {
302        enabled: true,
303
304        duration: 300,
305        easing: 'ease-in-out',
306        opener: function (openerElement) {
307          return openerElement.is('img')
308            ? openerElement
309            : openerElement.find('img');
310        },
311      },
312    });
313  }
314
315  /*------------------------------------------
316        = FUNCTION FORM SORTING GALLERY
317    -------------------------------------------*/
318  function sortingGallery() {
319    if ($('.sortable-gallery .gallery-filters').length) {
320      var $container = $('.gallery-container');
321      $container.isotope({
322        filter: '*',
323        animationOptions: {
324          duration: 750,
325          easing: 'linear',
326          queue: false,
327        },
328      });
329
330      $('.gallery-filters li a').on('click', function () {
331        $('.gallery-filters li .current').removeClass('current');
332        $(this).addClass('current');
333        var selector = $(this).attr('data-filter');
334        $container.isotope({
335          filter: selector,
336          animationOptions: {
337            duration: 750,
338            easing: 'linear',
339            queue: false,
340          },
341        });
342        return false;
343      });
344    }
345  }
346
347  sortingGallery();
348
349  /*------------------------------------------
350        = MASONRY GALLERY SETTING
351    -------------------------------------------*/
352  function masonryGridSetting() {
353    if ($('.masonry-gallery').length) {
354      var $grid = $('.masonry-gallery').masonry({
355        itemSelector: '.grid-item',
356        columnWidth: '.grid-item',
357        percentPosition: true,
358      });
359
360      $grid.imagesLoaded().progress(function () {
361        $grid.masonry('layout');
362      });
363    }
364  }
365
366  // masonryGridSetting();
367
368  /*------------------------------------------
369        = STICKY HEADER
370    -------------------------------------------*/
371
372  // Function for clone an element for sticky menu
373  function cloneNavForSticyMenu($ele, $newElmClass) {
374    $ele
375      .addClass('original')
376      .clone()
377      .insertAfter($ele)
378      .addClass($newElmClass)
379      .removeClass('original');
380  }
381
382  // clone home style 1 navigation for sticky menu
383  if ($('.site-header .navigation').length) {
384    cloneNavForSticyMenu($('.site-header .navigation'), 'sticky-header');
385  }
386
387  var lastScrollTop = '';
388
389  function stickyMenu($targetMenu, $toggleClass) {
390    var st = $(window).scrollTop();
391    var mainMenuTop = $('.wpo-site-header .navigation');
392
393    if ($(window).scrollTop() > 500) {
394      if (st > lastScrollTop) {
395        // hide sticky menu on scroll down
396        $targetMenu.removeClass($toggleClass);
397      } else {
398        // active sticky menu on scroll up
399        $targetMenu.addClass($toggleClass);
400      }
401    } else {
402      $targetMenu.removeClass($toggleClass);
403    }
404
405    lastScrollTop = st;
406  }
407
408  /*------------------------------------------
409        = Header search toggle
410    -------------------------------------------*/
411  if ($('.header-search-form-wrapper').length) {
412    var searchToggleBtn = $('.search-toggle-btn');
413    var searchContent = $('.header-search-form');
414    var body = $('body');
415
416    searchToggleBtn.on('click', function (e) {
417      searchContent.toggleClass('header-search-content-toggle');
418      e.stopPropagation();
419    });
420
421    body
422      .on('click', function () {
423        searchContent.removeClass('header-search-content-toggle');
424      })
425      .find(searchContent)
426      .on('click', function (e) {
427        e.stopPropagation();
428      });
429  }
430
431  /*------------------------------------------
432        = Header shopping cart toggle
433    -------------------------------------------*/
434  if ($('.mini-cart').length) {
435    var cartToggleBtn = $('.cart-toggle-btn');
436    var cartContent = $('.mini-cart-content');
437    var body = $('body');
438
439    cartToggleBtn.on('click', function (e) {
440      cartContent.toggleClass('mini-cart-content-toggle');
441      e.stopPropagation();
442    });
443
444    body
445      .on('click', function () {
446        cartContent.removeClass('mini-cart-content-toggle');
447      })
448      .find(cartContent)
449      .on('click', function (e) {
450        e.stopPropagation();
451      });
452  }
453
454  /*------------------------------------------
455        = FUNFACE
456    -------------------------------------------*/
457  if ($('.odometer').length) {
458    $('.odometer').appear();
459    $(document.body).on('appear', '.odometer', function (e) {
460      var odo = $('.odometer');
461      odo.each(function () {
462        var countNumber = $(this).attr('data-count');
463        $(this).html(countNumber);
464      });
465    });
466  }
467
468  /*------------------------------------------
469        = BACK TO TOP BTN SETTING
470    -------------------------------------------*/
471  $('body').append(
472    "<a href='#' class='back-to-top'><i class='ti-arrow-up'></i></a>"
473  );
474
475  function toggleBackToTopBtn() {
476    var amountScrolled = 500;
477    if ($(window).scrollTop() > amountScrolled) {
478      $('a.back-to-top').fadeIn('slow');
479    } else {
480      $('a.back-to-top').fadeOut('slow');
481    }
482  }
483
484  $('.back-to-top').on('click', function () {
485    $('html,body').animate(
486      {
487        scrollTop: 0,
488      },
489      700
490    );
491    return false;
492  });
493
494  /*------------------------------------------
495        = TESTIMONIALS SLIDER
496    -------------------------------------------*/
497  if ($('.testimonial-slider'.length)) {
498    $('.testimonial-slider').owlCarousel({
499      mouseDrag: false,
500      smartSpeed: 1500,
501      margin: 30,
502      autoplay: true,
503      loop: true,
504      nav: false,
505      dots: false,
506      items: 3,
507      responsive: {
508        0: {
509          items: 1,
510        },
511
512        650: {
513          items: 1,
514        },
515
516        768: {
517          items: 2,
518        },
519
520        992: {
521          items: 3,
522        },
523      },
524    });
525  }
526  /*------------------------------------------
527        destination-carousel
528    -------------------------------------------*/
529  if ($('.destination-carousel'.length)) {
530    $('.destination-carousel').owlCarousel({
531      loop: !0,
532      autoplaySpeed: 3e3,
533      navSpeed: 3e3,
534      paginationSpeed: 3e3,
535      slideSpeed: 3e3,
536      smartSpeed: 3e3,
537      autoplay: 3e3,
538      margin: 30,
539      nav: false,
540      dots: !1,
541      responsive: {
542        0: { items: 1 },
543        480: { items: 1 },
544        600: { items: 2 },
545        1024: { items: 2 },
546        1200: { items: 3 },
547      },
548    });
549  }
550  /*------------------------------------------
551        country-carousel
552    -------------------------------------------*/
553  if ($('.country-carousel'.length)) {
554    $('.country-carousel').owlCarousel({
555      loop: !0,
556      autoplaySpeed: 3e3,
557      navSpeed: 3e3,
558      paginationSpeed: 3e3,
559      slideSpeed: 3e3,
560      smartSpeed: 3e3,
561      autoplay: 3e3,
562      margin: 30,
563      nav: false,
564      dots: !1,
565      responsive: {
566        0: { items: 1 },
567        480: { items: 1 },
568        600: { items: 2 },
569        1024: { items: 2 },
570        1200: { items: 3 },
571      },
572    });
573  }
574
575  /*------------------------------------------
576        country-carousel
577    -------------------------------------------*/
578  if ($('.Room-carousel'.length)) {
579    $('.Room-carousel').owlCarousel({
580      loop: !0,
581      autoplaySpeed: 3e3,
582      navSpeed: 3e3,
583      paginationSpeed: 3e3,
584      slideSpeed: 3e3,
585      smartSpeed: 3e3,
586      autoplay: 3e3,
587      margin: 30,
588      nav: true,
589      navText: [
590        '<i class="ti-arrow-left"></i>',
591        '<i class="ti-arrow-right"></i>',
592      ],
593      dots: !1,
594      responsive: {
595        0: { items: 1 },
596        480: { items: 1 },
597        600: { items: 2 },
598        1024: { items: 2 },
599        1200: { items: 3 },
600      },
601    });
602  }
603
604  /*==========================================================================
605        WHEN DOCUMENT LOADING
606    ==========================================================================*/
607  $(window).on('load', function () {
608    preloader();
609
610    sliderBgSetting();
611
612    toggleMobileNavigation();
613
614    smallNavFunctionality();
615
616    sortingGallery();
617  });
618
619  /*==========================================================================
620        WHEN WINDOW SCROLL
621    ==========================================================================*/
622  $(window).on('scroll', function () {
623    if ($('.site-header').length) {
624      stickyMenu($('.site-header .navigation'), 'sticky-on');
625    }
626
627    toggleBackToTopBtn();
628  });
629
630  /*==========================================================================
631        WHEN WINDOW RESIZE
632    ==========================================================================*/
633  $(window).on('resize', function () {
634    toggleClassForSmallNav();
635    //smallNavFunctionality();
636
637    clearTimeout($.data(this, 'resizeTimer'));
638    $.data(
639      this,
640      'resizeTimer',
641      setTimeout(function () {
642        smallNavFunctionality();
643      }, 200)
644    );
645  });
646
647  /*------------------------------------------
648        = CONTACT FORM SUBMISSION
649    -------------------------------------------*/
650  // if ($('#contact-form').length) {
651  //   $('#contact-form').validate({
652  //     rules: {
653  //       fname: {
654  //         required: true,
655  //         minlength: 2,
656  //       },
657
658  //       lname: 'required',
659
660  //       subject: 'required',
661
662  //       email: 'required',
663
664  //       note: 'required',
665  //     },
666
667  //     messages: {
668  //       fname: 'Muista lisätä nimesi!',
669  //       email: 'Tämänkin tarvitsemme, jotta voimme vastata sinulle!',
670  //       note: 'Muista viestisi',
671  //     },
672
673  //     submitHandler: function (form) {
674  //       $.ajax({
675  //         type: 'POST',
676  //         url: '../../mail.php',
677  //         data: $(form).serialize(),
678  //         success: function () {
679  //           $('#loader').hide();
680  //           $('#success').slideDown('slow');
681  //           setTimeout(function () {
682  //             $('#success').slideUp('slow');
683  //           }, 3000);
684  //           form.reset();
685  //         },
686  //         error: function () {
687  //           $('#loader').hide();
688  //           $('#error').slideDown('slow');
689  //           setTimeout(function () {
690  //             $('#error').slideUp('slow');
691  //           }, 3000);
692  //         },
693  //       });
694  //       return false; // required to block normal submit since you used ajax
695  //     },
696  //   });
697  // }
698})(window.jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.