1// window resize æã«å®è¡ãã颿° 2 3window.addEventListener("DOMContentLoaded", function() { 4 5 function event_div_fix() { 6 7 //console.log("Width: " + window.innerWidth + " / Height: " + window.innerHeight); 8 //console.log(window.innerWidth); 9 10 // ã¬ã¹ãã³ã·ã対ç position: absolute; ãè¨å®ãã¦ããè¦ç´ 㯠11 // è¦ç´ ã®é«ãã 0 ã«ãªããããã¹ã¿ã¤ã«èª¿æ´ããã«ãã 12 // ãã®ããã対象å ã®è¦ç´ ãå®éã©ãã ãã®é«ããå¿ è¦ã確èªã 13 // ãã®è¦ç´ å ã®é«ããã¤ã³ã©ã¤ã³ã¹ã¿ã¤ã«ã·ã¼ãã§è£å®ãã 14 15 // event_div ã¨ãã class ãä»ããè¦ç´ ãå ¨ã¦åå¾ãã 16 17 const target_elements = document.getElementsByClassName("event_div"); 18 19 //console.log(target_elements); 20 21 // åå¾ããæ å ±ãã«ã¼ãã§èª¿æ» 22 // ååè¦ç´ ã®ä¸ã®åº§æ¨ã¨ä¸ã®åº§æ¨ã調ã¹ã 23 // 調æ»ãããã®ã¯ 24 // .event_div > .contents > h3 25 // .event_div > .contents > .thumbnail 26 27 // <div class="event_a event_div"> 28 // <div class="contents"> 29 // <h3><a href="https://localhost/...">[0] ãç¥ãããã¹ã #2</a></h3> â 調æ»å¯¾è±¡ 30 // <div class="thumbnail"><a href="https://localhost/..."><img src="https://localhost/...img.jpg" width="" height="" alt=""></a></div> â 調æ»å¯¾è±¡ 31 // </div> 32 // </div> 33 34 for (let n = 0; n < target_elements.length; n++) { 35 36 // å座æ¨ãåç´ããé å 37 38 let top_array = new Array();// ä¸è¾º = y 39 let bottom_array = new Array();// ä¸è¾º = y + height 40 41 // 調æ»å¯¾è±¡ã®ãã¼ããåå¾ 42 43 const this_h3 = target_elements[n]["childNodes"][1]["childNodes"][1]; 44 const this_thumbnail = target_elements[n]["childNodes"][1]["childNodes"][3]; 45 46 //console.log(this_h3); 47 //console.log(this_thumbnail); 48 49 // å座æ¨å¤ãªã©ãåå¾ 50 51 const this_h3_bcr = this_h3.getBoundingClientRect(); 52 const this_thumbnail_bcr = this_thumbnail.getBoundingClientRect(); 53 54 top_array.push( this_h3_bcr.y ); 55 top_array.push( this_thumbnail_bcr.y ); 56 bottom_array.push( (this_h3_bcr.y + this_h3_bcr.height) ); 57 bottom_array.push( (this_thumbnail_bcr.y + this_thumbnail_bcr.height) ); 58 59 // åç´ããé åã® top_array ã®æå°å¤ã¨ bottom_array ã®æå¤§å¤ã®å·®ã 60 // 対象ã¨ãªãè¦ç´ ã®é«ããè£å®ããããã«å¿ è¦ãªå¤ã§ããããã (ä¸ã«ç¶ã) 61 62 let this_top_value = Math.min.apply(null, top_array); 63 let this_bottom_value = Math.max.apply(null, bottom_array); 64 let this_difference = this_bottom_value - this_top_value; 65 66 // ããããã®ãã³ãã¬ã¼ãã§è¨ã㨠class="event_b" ã®ããã« 67 // h3 ãè¦ç´ ã®ä¸ãçªãæãã¦ããå ´åã¯ç®åºãããå¤ããã®ã¾ã¾è£æ£ãã㨠68 // è£æ£éå¤ã¨ãªãã®ã§çªãæããåãä¿®æ£ããå¿ è¦ããã (ç´°ãã話ãããã¨ã ã) 69 // ããã«è£æ£ãå¿ è¦ã¨å¤æããå ´å㯠h3 ã®æ¹ã .thumbnail ããã座æ¨ãä¸ã§ããå ´åå¿ è¦ããã 70 71 if ( top_array[0] < top_array[1] ) { 72 // ä¸ã¸çªãæããåè£æ£å¤ãæ¸ãã 73 this_difference = this_difference - ( top_array[1] - top_array[0] ); 74 } 75 76 //console.log("[" + n + "] - - - - - - - - - - - - - - -"); 77 //console.log("[" + n + "] h3"); 78 //console.log(this_h3_bcr); 79 //console.log("[" + n + "] thumbnail"); 80 //console.log(this_thumbnail_bcr); 81 82 //console.log(top_array); 83 //console.log(bottom_array); 84 //console.log(this_top_value); 85 //console.log(this_bottom_value); 86 //console.log(this_difference); 87 88 //console.log(this); 89 90 // è¦ç´ ã§ position: absolute; ãè¨å®ãã¦ããã®ã¯ãã©ã¦ã¶å¹ 600px 以ä¸ã¨ãã 91 // ãã以ä¸ã¯ä½¿ç¨ãã¦ããªãããè£æ£ã¯ç¡ãã¨ãã 92 93 if ( window.innerWidth > 600 ) { 94 target_elements[n].style.paddingBottom = this_difference + "px"; 95 } else { 96 target_elements[n].style.paddingBottom = "0px"; 97 } 98 99 //const this_array = target_elements[n].getBoundingClientRect(); 100 //top_array.push( Number(this_array.top) ); 101 //bottom_array.push( Number(this_array.bottom) ); 102 103 } 104 105 // ã«ã¹ã¿ã æç¨¿ä¸è¦§ã®ããã¯ã¹é«ããæãã 106 // .custom_post_box 107 108 const target_cpb = document.getElementsByClassName("custom_post_box"); 109 110 //console.log(target_cpb); 111 112 // 2è¦ç´ ãã¤å¦çãã¦ãã ( for ã 2é£ã°ãã§ã«ã¼ã ) 113 114 for ( let cpd = 0; cpd < target_cpb.length; cpd = cpd + 2 ) { 115 116 // 2å表示ãªã®ã§ 1åç® ã¨ 2åç®, 3åç® ã¨ 4åç® ã¨ã§é«ããæãã 117 118 //console.log(target_cpb); 119 120 let element_1st = target_cpb[cpd]; 121 let element_2st = target_cpb[cpd + 1]; 122 123 // è²ã å¦çããåã«é«ããã¯ãªã¢ããã 124 125 element_1st.style.height = ""; 126 element_2st.style.height = ""; 127 128 let rect_1st = element_1st.getBoundingClientRect(); 129 let rect_2st = element_2st.getBoundingClientRect(); 130 131 let height_1st = element_1st.clientHeight; 132 let height_2st = element_2st.clientHeight; 133 134 let top_1st = rect_1st.top; 135 let top_2st = rect_2st.top; 136 137 //console.log( "{" + cpd + "} Height: " + height_1st + ", top: " + top_1st ); 138 //console.log( "{" + (cpd + 1) + "} Height: " + height_2st + ", top: " + top_2st ); 139 140 // y座æ¨ãåãå ´åã¯2åã§è¡¨ç¤ºããã¦ããã¨ã¿ãªã
140ãåæ¹ã®é«ããæãã 141 // (å¤ã®å¤§ããæ¹ã«æãã) 142 143 let height_value_array = new Array(height_1st, height_2st); 144 145 if ( top_1st === top_2st ) { 146 147 element_1st.style.height = Math.max(height_1st, height_2st) + "px"; 148 element_2st.style.height = Math.max(height_1st, height_2st) + "px"; 149 150 } else { 151 152 element_1st.style.height = ""; 153 element_2st.style.height = ""; 154 155 } 156 157 } 158 159 } 160 161 window.addEventListener("resize", function() { 162 event_div_fix(); 163 }); 164 165 event_div_fix();// èªã¿è¾¼ã¿æã«ãå®è¡ 166 167}); 168 169
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.