Track window and element resize events with ResizeObserver
Resize the boxes below to see real-time dimension updates:
Width: px
Height: px
💡 Drag the resize handle in the bottom-right corner
Width: px
Height: px
💡 Drag the resize handle in the bottom-right corner
This container changes its layout based on its own width (container queries simulation):
Current layout:
💡 Drag the right edge to change container width
Different timing strategies for performance optimization:
Updates:
💡 Drag corner to resize - updates every 50ms
Updates:
💡 Drag corner to resize - updates after 150ms pause
Updates:
💡 Drag corner to resize - updates every 500ms
Access both element and window dimensions for responsive design:
Element Width: px
Element Height: px
Window Width: px
Window Height: px
Element vs Window: % of window width
💡 Drag corners to resize this container
New elements automatically get resize detection:
data_resize="$width = $resize_width; $height = $resize_height"
- Direct assignment data_resize=(signal.add(1), dict(throttle=50))
- With throttling data_resize=(signal.add(1), dict(debounce=150))
- With debouncing resize_width, resize_height, resize_window_width, resize_window_height
resize_aspect_ratio, resize_current_breakpoint, resize_is_mobile/tablet/desktop
resize_xs, resize_sm, resize_md, resize_lg, resize_xl