Add and remove classes on resize
I've used matchMedia() quite a bit in the past, it works quite well:
https://github.com/paulirish/matchMedia.js/

Example:

if (matchMedia('only screen and (max-width: 480px)').matches) {
  // smartphone/iphone... maybe run some small-screen related dom scripting?
}


Also instead of individually doing .addClass('class') and .removeClass('class') you could use .toggleClass('class').