I am admittedly new to developing responsive websites. I implemented one using media queries based upon some breakpoints. During testing, I found that the whole approach of using media queries for widths is seriously flawed because of inclusion of scrollbar width, unless there is a meaningful way to determine that dynamically. Historically that was not even consistent. See this on stackoverflow posted in 2011, for example.
$(window).width() consistently returns width without scrollbars. Though there was a discussion on the Jquery forum on this issue, no changes were made. So why use media query for width at all, when you can use jquery resize event handler?
I am aware that I need to handle throttling during Jquery's resize event handling but that is easy to do using setTimeout and clearTimeout.
If it is required to find if it is a mobile device, user-agent in the http request and/or screen.width should suffice to get that info.