PageSourceSearch

https://www.vegasalmon.dk/wp-content/themes/hello-elementor-child/assets/js/general.js

js vegasalmon.dk collected 2026-10-09 22:41:30 UTC 5,912 bytes, 214 lines download raw bytes

1jQuery(document).ready(function ($) {
2  $(".close-icon").on("click", function (e) {
3    e.preventDefault();
4
5    $("#mega-menu-wrap .elementskit-megamenu-panel").removeClass(
6      "ekit-dropdown-open-onclick",
7    );
8
9    $("#mega-menu-wrap .ekit-menu-nav-link").removeClass("active");
10  });
11});
12
13document.addEventListener("DOMContentLoaded", function () {
14  function handleImageBoxClick() {
15    // Check if viewport width is greater than 1024 pixels
16    if (window.innerWidth > 1024) {
17      const imageBoxes = document.querySelectorAll(".image_box");
18
19      imageBoxes.forEach(function (imageBox) {
20        imageBox.addEventListener("click", function () {
21          // Toggle "expanded" class for the clicked .image_box
22          this.classList.toggle("expanded");
23
24          // Check if the imageBox is inside a right_image_box
25          const rightImageBox = this.closest(".right_image_box");
26          if (rightImageBox) {
27            rightImageBox.classList.toggle("full-image");
28          }
29        });
30      });
31    }
32  }
33
34  // Initial setup
35  handleImageBoxClick();
36
37  // Handle resize event
38  window.addEventListener("resize", handleImageBoxClick);
39});
40
41// jQuery(document).ready(function () {
42//   jQuery(".left_image_box").appendTo(".right_image_box");
43// });
44
45jQuery(document).ready(function () {
46  function moveImageBox() {
47    if (jQuery(window).width() < 1024) {
48      // Move .left_image_box inside .right_image_box
49      jQuery(".left_image_box .elementor-widget-image").appendTo(
50        ".right_image_box",
51      );
52    } else {
53      // Move .left_image_box back to its default position if needed
54      // Replace .original_parent with the selector of the original parent
55      jQuery(".left_image_box").appendTo(".image_box_container");
56    }
57  }
58
59  // Initial check
60  moveImageBox();
61
62  // Check on resize
63  jQuery(window).resize(function () {
64    moveImageBox();
65  });
66});
67
68jQuery(document).ready(function () {
69  function initializeSlider() {
70    if (jQuery(window).width() < 1025) {
71      // Check if the slider is not already initialized
72      //       if (!jQuery(".right_image_box").hasClass("slick-initialized")) {
73      // Initialize the Slick slider
74      jQuery(".right_image_box").slick({
75        // Add your slider options here
76        dots: true,
77        infinite: true,
78        speed: 300,
79        slidesToShow: 1,
80        slidesToScroll: 1,
81      });
82      //       }
83    } else {
84      // If viewport width is 1024px or greater, destroy the slider if it exists
85      if (jQuery(".right_image_box").hasClass("slick-initialized")) {
86        jQuery(".right_image_box").slick("unslick");
87      }
88    }
89  }
90
91  // Initial check
92  initializeSlider();
93
94  // Check on resize
95  //   jQuery(window).resize(function () {
96  //     initializeSlider();
97  //   });
98
99  // Related Posts Slider
100
101  jQuery(".related-posts").slick({
102    dots: true,
103    infinite: true,
104    speed: 300,
105    slidesToShow: 1,
106    slidesToScroll: 1,
107  });
108});
109
110function lastWordFromClass(selectClass, addClass) {
111  var elements = document.querySelectorAll(selectClass);
112
113  elements.forEach(function (element) {
114    var originalString = element.innerHTML;
115    var splitWords = originalString.split(" ");
116    var lastWord = splitWords.pop(); // Get the last word
117    var restOfString = splitWords.join(" "); // Join the remaining words
118
119    element.innerHTML =
120      restOfString + " <span class='" + addClass + "'>" + lastWord + "</span>";
121  });
122}
123
124// Example usage:
125lastWordFromClass(".product_grid .upk-title a", "highlight");
126
127jQuery(document).ready(function () {
128  jQuery(window).scroll(function () {
129    if (jQuery(window).scrollTop() >= 100) {
130      jQuery(".elementor-location-header").addClass("fixed-header");
131    } else {
132      jQuery(".elementor-location-header ").removeClass("fixed-header");
133    }
134  });
135});
136
137jQuery(document).ready(function ($) {
138  $(".single-products .single-post-title .elementor-heading-title").each(
139    function () {
140      var heading = $(this).text().trim();
141      var lastSpaceIndex = heading.lastIndexOf(" ");
142
143      if (lastSpaceIndex !== -1) {
144        var lastWord = heading.substring(lastSpaceIndex + 1);
145        var newHeading =
146          heading.substring(0, lastSpaceIndex) +
147          "<span>" +
148          lastWord +
149          "</span>";
150        $(this).html(newHeading);
151      }
152    },
153  );
154});
155
156// Blogs Slider Home
157
158jQuery(document).ready(function ($) {
159  function prepareSlides() {
160    $(".sk-posts-masonry .sk-post-item").each(function () {
161      // wrap for slick
162      if (!$(this).parent().hasClass("custom-slick-item")) {
163        $(this).wrap('<div class="custom-slick-item"></div>');
164      }
165
166      var $linkWrap = $(this).find(".sk-post-link");
167      var $bodyWrapper = $(this).find(".sk-post-body-wrapper");
168
169      if ($linkWrap.length && $bodyWrapper.length) {
170        var postLink = $linkWrap.find("a").attr("href");
171
172        // avoid duplicate button
173        if (!$bodyWrapper.find(".custom-btn").length && postLink) {
174          var btn = `
175                    <a href="${postLink}" class="custom-btn" target='_blank'>
176                        Read article
177                    </a>
178                `;
179
180          $bodyWrapper.append(btn);
181        }
182      }
183    });
184  }
185
186  function initSlick() {
187    var $el = $(".sk-posts-masonry");
188
189    if ($el.length && !$el.hasClass("slick-initialized")) {
190      prepareSlides();
191
192      $el.slick({
193        slidesToShow: 3,
194        slidesToScroll: 1,
195        arrows: true,
196        dots: false,
197        infinite: true,
198        autoplay: false,
199        speed: 500,
200        responsive: [
201          { breakpoint: 1024, settings: { slidesToShow: 2 } },
202          { breakpoint: 768, settings: { slidesToShow: 1 } },
203        ],
204      });
205    }
206  }
207
208  var slickInterval = setInterval(function () {
209    if ($(".sk-posts-masonry .sk-post-item").length) {
210      initSlick();
211      clearInterval(slickInterval);
212    }
213  }, 500);
214});

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.