javascript
1const elm = document.createElement("div") 2elm.style.width = "100%" 3 4console.log("width",elm.offsetWidth); // 1 5 6elm.addEventListener("resize",()=>{ 7 console.log('Resize!!'); 8}) 9 10document.body.appendChild(elm) 11// 3 12 13console.log("width",elm.offsetWidth); // 2
1と2で結果が違います。しかしResize!!
は出力されていません
3のタイミングでResize!!
と出力させる方法を教えてください
回答1件
あなたの回答
tips
プレビュー