try using clientWidth/Height instead of innerWidth/Height in getscroll
Attach a file by drag & drop or click to upload