1/** 2 * Copyright ©2024 ITG Commerce. All rights reserved. 3 * See COPYING.txt for license details. 4 * @author: Aatish Kori <[email protected]> 5 */ 6 7require([ 8 'jquery' 9], function ($) { 10 var background_image = $(".home-slider .pagebuilder-slide-wrapper").attr( "data-background-images" ); 11 if (background_image) { 12 var background_image_obj = JSON.parse(background_image.replace(/\\/g, "")); 13 14 var ratio = .366; 15 const img = new Image(); 16 img.onload = function() { 17 ratio = this.height / this.width; 18 var min_height = $( window ).width() * ratio; 19 if ($(window).width() > 650 && $(window).width() <= 767) { 20 $('.home-slider .pagebuilder-slider').css('min-height', '400px'); 21 } else { 22 $('.home-slider .pagebuilder-slider').css('min-height', min_height+'px'); 23 } 24 } 25 26 function background_for_mobile() { 27 if ($(window).width() > 650 && $(window).width() <= 767) { 28 $('[data-content-type="slide"] .pagebuilder-slide-wrapper').css('background-size', 'cover'); 29 $('[data-content-type="slide"] .pagebuilder-slide-wrapper').css('background-position', 'center'); 30 } 31 32 if (background_image_obj.mobile_image) { 33 img.src = background_image_obj.mobile_image; 34 } else if(background_image_obj.tablet_image) { 35 img.src = background_image_obj.tablet_image; 36 } else { 37 img.src = background_image_obj.desktop_image; 38 } 39 } 40 41 function background_for_tablet() { 42 if (background_image_obj.tablet_image) { 43 img.src = background_image_obj.tablet_image; 44 } else { 45 img.src = background_image_obj.desktop_image; 46 } 47 } 48 49 function background_for_desktop() { 50 img.src = background_image_obj.desktop_image; 51 } 52 53 if ($(window).width() < 768) { 54 background_for_mobile(); 55 } 56 57 $(window).resize(function(){ 58 if ($(window).width() < 768) { 59 background_for_mobile(); 60 } 61 }); 62 63 if ($(window).width() >= 768 && $(window).width() <= 1024) { 64 background_for_tablet() 65 } 66 67 $(window).resize(function(){ 68 if ($(window).width() >= 768 && $(window).width() <= 1024) { 69 background_for_tablet(); 70 } 71 }); 72 73 if ($(window).width() > 1024 ) { 74 background_for_desktop() 75 } 76 77 $(window).resize(function(){ 78 if ($(window).width() > 1024 ) { 79 background_for_desktop() 80 } 81 }); 82 } 83});
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.