apply offscreen class after calculating width because offscreen class resets the width. also use css('width') when copying width if it returns a usable value. fixes #1140. fixes #1079