Major refactor of the resize function (WIP)

This still needs more improvement but
finally we’re getting closer to get this beast
working in browsers.

Still open:
- Better code quality
- margin-left / right pos of pseudo close element