const mqls = window.matchMedia("(max-width: 850px)");

function mediaqueryresponse(mql) {
  console.log(`mediaquery breakpoint fired`)
}

function resizeHandler(event) {
  console.log(`resize event fired`)
}

// attach listener function to listen in on state changes
mqls.addEventListener('change', mediaqueryresponse);
// attach listener function to window on resize
window.addEventListener('resize', resizeHandler);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js