Instead of using JS, just use CSS 100% width and height. This also resolves a jitter that occurs on edge when a modal's container appends to the body.