Added undefined check

In some cases the ```modalDimensions``` method is called with an object that has no style, causing the script to break on ```that.style.width```.
I am not sure when/why that happens (passing of wrong type of element), but it does in some cases.

I added a check to test if ```that``` and ```that.style``` are not undefined.