Avoid to load code by cdn, much better local code
Better jQuery than plain javascript code, more easy to read and less error prone
Keep it simple, better 5 "if" than 1 hanging recursive function
You need to discriminate on the given screen size at load and resize time, that's mostly the reoccuring scheme
You got it, you can change css element properties by javascript code
getBoundingClientRect() is your friend expecially against rapid property value changes
Undoubtly you reached a bottleneck that you can solve mixing js with php code only, that is allowed too
You can also do awesome stuff on dragndrop and Prototype, please try
Avoid other javascript frameworks if they don't make it simpler to you