1$(function() { 2 // åãæ¿ãã対象ã«class屿§ã 3 var $elem = $('.switch'); 4 // åãæ¿ãã®å¯¾è±¡ã®src屿§ã®æ«å°¾ã®æååã 5 var sp = '_sp.'; 6 var pc = '_pc.'; 7 // ç»åãåãæ¿ããã¦ã£ã³ãã¦ãµã¤ãºã 8 var replaceWidth = 768; 9 10 function imageSwitch() { 11 // ã¦ã£ã³ãã¦ãµã¤ãºãåå¾ããã 12 var windowWidth = parseInt($(window).width()); 13 14 // ãã¼ã¸å ã«ãããã¹ã¦ã®`.switch`ã«é©å¿ãããã 15 $elem.each(function() { 16 var $this = $(this); 17 // ã¦ã£ã³ãã¦ãµã¤ãºã768px以ä¸ã§ããã°_spã_pcã«ç½®æããã 18 if(windowWidth >= replaceWidth) { 19 $this.attr('src', $this.attr('src').replace(sp, pc)); 20 21 // ã¦ã£ã³ãã¦ãµã¤ãºã768pxæªæºã§ããã°_pcã_spã«ç½®æããã 22 } else { 23 $this.attr('src', $this.attr('src').replace(pc, sp)); 24 } 25 }); 26 } 27 imageSwitch(); 28 29 // åçãªãªãµã¤ãºã¯æä½å¾0.2ç§çµã£ã¦ããå¦çãå®è¡ããã 30 var resizeTimer; 31 $(window).on('resize', function() { 32 clearTimeout(resizeTimer); 33 resizeTimer = setTimeout(function() { 34 imageSwitch(); 35 }, 200); 36 }); 37 });
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.