You can put the code you want to remove in a separate js file, than append the file link when the browser width is above 980px, and then remove the file when its bellow 980px. I updated the pen.
Although i’m not even sure if that will work. I don’t know if removing a js file will also remove the js on the website in real-time. Also its likely theres an easier way of doing what your asking for.