1(function ($) {
2 'use strict';
3
4 // Function to hide preloader
5 var preloader = $('.wf_preloader');
6 function initHidePreloader() {
7 $('body').addClass('overlay--enabled')
8 if (preloader.length) {
9 preloader.addClass('loaded');
10 preloader.delay(600).fadeOut();
11 $('body').removeClass('overlay--enabled');
12 }
13 }
14 if (preloader.length) {
15 $('.wf_preloader-close').on('click', function () {
16 preloader.addClass('loaded');
17 preloader.delay(600).fadeOut();
18 $('body').removeClass('overlay--enabled');
19 });
20 }
21 // Function to initialize Owl Carousels
22 function initOwlCarousels() {
23 $(".wf_owl_carousel").each(function () {
24 var carousel = $(this);
25 var options = carousel.data("owl-options");
26 carousel.owlCarousel(
27 typeof options === "object" ? options : JSON.parse(options)
28 );
29
30 // Add event listener to identify and style the last item
31 carousel.on('changed.owl.carousel', function (event) {
32 var items = event.item.count; // Total number of items in the carousel
33 var currentItem = event.item.index; // Index of the current item
34
35 // Remove class from previously last item
36 carousel.find('.owl-item').removeClass('owl-last');
37
38 // Add class to current last item
39 if (currentItem + 1 === items) {
40 carousel.find('.owl-item').eq(currentItem).addClass('owl-last');
...
</html>