1(function($) { 2 $.fn.viewimageresize = function(selector) 3 { 4 var cfg = { 5 selector: "img" 6 }; 7 8 if(typeof selector == "object") { 9 cfg = $.extend(cfg, selector); 10 } else { 11 if(selector) { 12 cfg = $.extend({ selector: selector }); 13 } 14 } 15 16 var $img = this.find(cfg.selector); 17 var $this = this; 18 19 $img.removeAttr("height") 20 .css("height", ""); 21 22 function image_resize() 23 { 24 var width = $this.width(); 25 26 $img.each(function() { 27 28 if ($(this).attr("loading") === "lazy") return; // loading="lazy" ìì±ì´ ìë ê²½ì° ê±´ëë 29 30 if($(this).data("width") == undefined) 31 $(this).data("width", $(this).width()); 32 33 if($(this).data("width") > width) { 34 $(this).removeAttr("width") 35 .removeAttr("height") 36 .css("width","") 37 .css("height", ""); 38 39 if($(this).data("width") > width) { 40 $(this).css("width", "100%"); 41 } 42 } else { 43 $(this).attr("width", $(this).data("width")); 44 } 45 }); 46 } 47 48 $(window).on("load", function() { 49 image_resize(); 50 }); 51 52 $(window).on("resize", function() { 53 image_resize(); 54 }); 55 } 56 57 $.fn.viewimageresize2 = function(selector) 58 { 59 var cfg = { 60 selector: "img" 61 }; 62 63 if(typeof selector == "object") { 64 cfg = $.extend(cfg, selector); 65 } else { 66 if(selector) { 67 cfg = $.extend({ selector: selector }); 68 } 69 } 70 71 var $img = this.find(cfg.selector); 72 var $this = this; 73 74 function image_resize() 75 { 76 var width = $this.width(); 77 78 $img.each(function() { 79 80 if ($(this).attr("loading") === "lazy") return; // loading="lazy" ìì±ì´ ìë ê²½ì° ê±´ëë 81 82 $(this).removeAttr("width") 83 .removeAttr("height") 84 .css("width","") 85 .css("height", ""); 86 87 if($(this).data("width") == undefined) 88 $(this).data("width", $(this).width()); 89 90 if($(this).data("width") > width) { 91 $(this).css("width", "100%"); 92 } 93 }); 94 } 95 96 $(window).on("resize", function() { 97 image_resize(); 98 }); 99 100 image_resize(); 101 } 102}(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.