사용자 도구

사이트 도구


html:resize

ResizeObserver

                const resizeObserver = new ResizeObserver((entries) => {
                    for (let entry of entries) {
                        var msg = "good! ";
                        if (entry.contentBoxSize) {
                            msg += "boxSize:";
                            if (entry.contentBoxSize[0]) {
                                msg += entry.contentBoxSize[0].inlineSize;
                                msg += ":";
                                msg += entry.contentBoxSize[0].blockSize;
                            } else {
                                msg += entry.contentBoxSize.inlineSize;
                                msg += ":";
                                msg += entry.contentBoxSize.blockSize;
                            }
                            msg += ":";
                        } else {
                            msg += "rectSize:";
                            msg += entry.contentRect.width;
                            msg += ":";
                            msg += entry.contentRect.height;
                            msg += ":";
                        }
                        msg += "body-width : " + $("body").width() + "; ";
                        msg += "body-height : " + $("body").height() + "; ";
                        msg += "main-width : " + $("main").width() + "; ";
                        msg += "main-height : " + $("main").height() + "; ";
                        $("#message").html(msg);
                    }
                });
 
                resizeObserver.observe(document.querySelector("#content"));
 
html/resize.txt · 마지막으로 수정됨: 2025/04/15 10:05 저자 127.0.0.1