1jQuery(document).ready(function ($) { 2 $(".inch-slider").each(function () { 3 var slider = $(this); 4 var images = slider.find("img"); 5 var loadedImages = 0; 6 7 images.each(function () { 8 if (this.complete) { 9 loadedImages++; 10 } else { 11 $(this).on("load", function () { 12 loadedImages++; 13 if (loadedImages === images.length) { 14 adjustSlider(slider); 15 } 16 }); 17 } 18 }); 19 20 // If all images were already loaded 21 if (loadedImages === images.length) { 22 adjustSlider(slider); 23 } 24 }); 25 26 function adjustSlider(target) { 27 //find parent .inch-comparison-section-interior and set its visibility to visible 28 target 29 .parents(".inch-comparison-section-interior") 30 .animate({ opacity: 1 }, 500); 31 target.each(function () { 32 var cur = $(this); 33 // Adjust the slider 34 var width = cur.width() + "px"; 35 cur.find(".resize img").css("width", width); 36 // Bind dragging events 37 drags(cur.find(".handle"), cur.find(".resize"), cur); 38 }); 39 } 40 41 // Update sliders on resize. 42 // Because we all do this: i.imgur.com/YkbaV.gif 43 $(window).resize(function () { 44 $(".inch-slider").each(function () { 45 var cur = $(this); 46 setTimeout(function () { 47 var width = cur.width() + "px"; 48 cur.find(".resize img").css("width", width); 49 }, 500); 50 }); 51 }); 52 53 function drags(dragElement, resizeElement, container) { 54 // Initialize the dragging event on mousedown. 55 dragElement 56 .on("mousedown touchstart", function (e) { 57 dragElement.addClass("draggable"); 58 resizeElement.addClass("resizable"); 59 60 // Check if it's a mouse or touch event and pass along the correct value 61 var startX = e.pageX 62 ? e.pageX 63 : e.originalEvent.touches[0].pageX; 64 65 // Get the initial position 66 var dragWidth = dragElement.outerWidth(), 67 posX = dragElement.offset().left + dragWidth - startX, 68 containerOffset = container.offset().left, 69 containerWidth = container.outerWidth(); 70 71 // Set limits 72 minLeft = containerOffset + 10; 73 maxLeft = containerOffset + containerWidth - dragWidth - 10; 74 75 // Calculate the dragging distance on mousemove. 76 dragElement 77 .parents() 78 .on("mousemove touchmove", function (e) { 79 // Check if it's a mouse or touch event and pass along the correct value 80 var moveX = e.pageX 81 ? e.pageX 82 : e.originalEvent.touches[0].pageX; 83 84 leftValue = moveX + posX - dragWidth; 85 86 // Prevent going off limits 87 if (leftValue < minLeft) { 88 leftValue = minLeft; 89 } else if (leftValue > maxLeft) { 90 leftValue = maxLeft; 91 } 92 93 // Translate the handle's left value to masked divs width. 94 widthValue = 95 ((leftValue + dragWidth / 2 - containerOffset) * 96 100) / 97 containerWidth + 98 "%"; 99 100 // Set the new values for the slider and the handle. 101 // Bind mouseup events to stop dragging. 102 $(".draggable") 103 .css("left", widthValue) 104 .on("mouseup touchend touchcancel", function () { 105 $(this).removeClass("draggable"); 106 resizeElement.removeClass("resizable"); 107 }); 108 $(".resizable").css("width", widthValue); 109 }) 110 .on("mouseup touchend touchcancel", function () { 111 dragElement.removeClass("draggable"); 112 resizeElement.removeClass("resizable"); 113 }); 114 e.preventDefault(); 115 }) 116 .on("mouseup touchend touchcancel", function (e) { 117 dragElement.removeClass("draggable"); 118 resizeElement.removeClass("resizable"); 119 }); 120 } 121}); 122; 123jQuery(document).ready(function($) { 124 $('.inch-image-carousel-interior').each(function() { 125 let carousel = $(this); 126 let slides = carousel.find('.inch-image-carousel-interior__slide'); 127 let descriptions = carousel.find('.inch-image-carousel-interior__description'); 128 let indicators = carousel.find('.inch-image-slide-indicator'); 129 let currentIndex = 0; 130 131 let prevButton = carousel.find('.inch-image-carousel-arrow--prev'); 132 let nextButton = carousel.find('.inch-image-carousel-arrow--next'); 133 134 // Show the first slide 135 slides.eq(currentIndex).addClass('active').fadeIn(); 136 descriptions.eq(currentIndex).addClass('active').fadeIn(); 137 indicators.eq(currentIndex).addClass('active'); 138 139 // Activate or deactivate the previous and next buttons if the current slide is the first or the last 140 function buttonSetActive() { 141 if (currentIndex === 0) { 142 prevButton.addClass('inactive'); 143 } else { 144 prevButton.removeClass('inactive'); 145 } 146 147 if (currentIndex === slides.length - 1) { 148 nextButton.addClass('inactive'); 149 } else { 150 nextButton.removeClass('inactive'); 151 } 152 } 153 154 // Initialize button states 155 buttonSetActive(); 156 157 function disableButtons() { 158 prevButton.addClass('disabled'); 159 nextButton.addClass('disabled'); 160 } 161 162 function enableButtons() { 163 prevButton.removeClass('disabled'); 164 nextButton.removeClass('disabled'); 165 } 166 167 indicators.on('click', function() { 168 let index = $(this).index(); 169 if (index !== currentIndex) { 170 disableButtons(); 171 indicators.eq(currentIndex).removeClass('active'); 172 173 slides.eq(currentIndex).removeClass('active').addClass('fade-out').fadeOut(function() { 174 $(this).removeClass('fade-out'); 175 }); 176 descriptions.eq(currentIndex).removeClass('active').addClass('fade-out').fadeOut(function() { 177 $(this).removeClass('fade-out'); 178 // Show the next slide and description after the current ones are hidden 179 slides.eq(index).fadeIn().addClass('active'); 180 descriptions.eq(index).fadeIn().addClass('active'); 181 indicators.eq(index).addClass('active'); 182 currentIndex = index; 183 buttonSetActive(); 184 enableButtons(); 185 }); 186 } 187 $(this).addClass('active'); 188 }); 189 190 prevButton.on('click', function() { 191 if (currentIndex > 0 && !prevButton.hasClass('disabled')) { 192 disableButtons(); 193 // Move the current slide to the left 194 indicators.eq(currentIndex).removeClass('active'); 195 slides.eq(currentIndex).removeClass('active').addClass('fade-out').fadeOut(function() { 196 $(this).removeClass('fade-out'); 197 }); 198 descriptions.eq(currentIndex).removeClass('active').addClass('fade-out').fadeOut(function() { 199 $(this).removeClass('fade-out'); 200 currentIndex--; 201 // Move the previous slide to the right 202 slides.eq(currentIndex).fadeIn().addClass('active'); 203 descriptions.eq(currentIndex).fadeIn().addClass('active'); 204 indicators.eq(currentIndex).addClass('active'); 205 buttonSetActive(); 206 enableButtons(); 207 }); 208 } 209 }); 210 211 nextButton.on('click', function() { 212 if (currentIndex < slides.length - 1 && !nextButton.hasClass('disabled')) { 213 disableButtons(); 214 // Move the current slide to the right 215 indicators.eq(currentIndex).removeClass('active'); 216 slides.eq(currentIndex).removeClass('active').addClass('fade-out').fadeOut(function() { 217 $(this).removeClass('fade-out'); 218 }); 219 descriptions.eq(currentIndex).removeClass('active').addClass('fade-out').fadeOut(function() { 220 $(this).removeClass('fade-out'); 221 currentIndex++; 222 // Move the next slide to the left 223 slides.eq(currentIndex).fadeIn().addClass('active'); 224 descriptions.eq(currentIndex).fadeIn().addClass('active'); 225 indicators.eq(currentIndex).addClass('active'); 226 buttonSetActive(); 227 enableButtons(); 228 }); 229 } 230 }); 231 }); 232}); 233; 234jQuery(document).ready(function($) { 235 $('.inch-image-illustration-interior__description-wrapper').each(function() { 236 $(this).on('click', function() { 237 $(this).toggleClass('active'); 238 $(this).find('.illustration-panel-description').slideToggle(); 239 }); 240 }); 241}); 242; 243jQuery(document).ready(function ($) { 244 let parents = []; 245 let dropdownSections = $(".dropdown-section"); 246 247 let targetNodes = $(".acf-block"); 248 var config = { 249 childList: true, 250 subtree: true, 251 attributes: true, 252 }; 253 254 var callback = function (mutationsList, observer) { 255 //get the element that triggered the mutation 256 let mutation = mutationsList[0]; 257 //get the .dropdown-section that is a child of the element that triggered the mutation 258 259 //check if it is active 260 if ( 261 $(mutation.target).hasClass("dropdown-section") && 262 $(mutation.target).hasClass("active") 263 ) { 264 //wait for the mutation to finish 265 setTimeout(function () { 266 //get the parent .acf-block 267 let parentSection = $(mutation.target).parents( 268 ".ev-blocks--section-block" 269 )[0]; 270 //get it's height 271 let parentHeight = $(parentSection).height(); 272 //set the height of the .dropdown-section to the height of the parent 273 $(parentSection).css("height", parentHeight); 274 }, 300); 275 observer.disconnect(); 276 } 277 }; 278 279 var observer = new MutationObserver(callback); 280 targetNodes.each(function () { 281 observer.observe(this, config); 282 }); 283 284 dropdownSections.each(function (section) { 285 if ($(this).parents(".acf-block")[0] != parents[parents.length - 1]) { 286 parents.push($(this).parents(".acf-block")[0]); 287 $(this).addClass("active"); 288 } 289 }); 290 291 dropdownSections.on("click", function () { 292 dropdownSections.each(function () { 293 $(this).removeClass("active"); 294 }); 295 $(this).addClass("active"); 296 }); 297}); 298; 299jQuery(document).ready(function($) { 300 $('.dropdown-media-section').each(function() { 301 let galleryItems = $(this).find('.dropdown-media').find('figure'); 302 let dropdownSections = $(this).find('.dropdown-section'); 303 //index the dropdown sections 304 dropdownSections.each(function(index) { 305 $(this).attr('data-index', index); 306 }); 307 // //index the gallery images 308 galleryItems.each(function(index) { 309 //class is required to stop lazy loading from breaking the fade animation 310 $(this).attr('data-index', index).addClass('no-transition'); 311 }); 312 313 dropdownSections.on('click', function() { 314 //get the index of the dropdown section 315 if ($(this).hasClass('current')) { 316 return; 317 } else { 318 dropdownSections.removeClass('current'); 319 $(this).addClass('current'); 320 } 321 let index = $(this).attr('data-index'); 322 //hide all images 323 galleryItems.fadeOut(400, function() { 324 // This callback will be called once for each image that finishes fading out 325 }); 326 327 // After all images have started to fade out, fade in the image with the same index 328 // This should be outside the fadeOut callback to ensure it only happens once 329 galleryItems.filter('[data-index="' + index + '"]').css("display", "flex").hide().fadeIn(); 330 }); 331 }); 332}); 333; 334jQuery(document).ready(function($) { 335 $('.inch-quote-carousel').each(function() { 336 let carousel = $(this); 337 let slides = carousel.find('.quote-card'); 338 339 // Previous and next buttons need to be active or inactive based on the current slide 340 let prevButton = carousel.find('.quote-carousel-arrow--prev'); 341 let nextButton = carousel.find('.quote-carousel-arrow--next'); 342 343 // Show the first slide 344 let currentIndex = 0; 345 slides.eq(currentIndex).addClass('active').fadeIn(); 346 347 // Activate or deactivate the previous and next buttons if the current slide is the first or the last 348 function buttonSetActive() { 349 if (currentIndex === 0) { 350 prevButton.addClass('inactive'); 351 prevButton.removeClass('active'); 352 } else { 353 prevButton.removeClass('inactive'); 354 prevButton.addClass('active'); 355 } 356 357 if (currentIndex === slides.length - 1) { 358 nextButton.addClass('inactive'); 359 nextButton.removeClass('active'); 360 } else { 361 nextButton.removeClass('inactive'); 362 nextButton.addClass('active'); 363 } 364 } 365 366 // Initialize button states 367 buttonSetActive(); 368 369 prevButton.on('click', function() { 370 if (currentIndex > 0) { 371 // Move the current slide to the left 372 slides.eq(currentIndex).removeClass('active').addClass('fade-out').fadeOut(function() { 373 $(this).removeClass('fade-out'); 374 }); 375 currentIndex--; 376 // Move the previous slide to the right 377 slides.eq(currentIndex).fadeIn().addClass('active'); 378 buttonSetActive(); 379 } 380 }); 381 382 nextButton.on('click', function() { 383 if (currentIndex < slides.length - 1) { 384 // Move the current slide to the right 385 slides.eq(currentIndex).removeClass('active').addClass('fade-out').fadeOut(function() { 386 $(this).removeClass('fade-out'); 387 }); 388 currentIndex++; 389 // Move the next slide to the left 390 slides.eq(currentIndex).fadeIn().addClass('active'); 391 buttonSetActive(); 392 } 393 }); 394 }); 395}); 396;
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.