Replaced window.width with window.outerWidth to ensure proper window size detection.
Snippet now resets the box size before same sizing to fix bug
resolved merge conflit