I'm looking into a way for JavaScript to understand more than one media queries. At this point I've the following code to check the width of the browser, but I want to create more queries. Google (and Stack) only showed me the code I've already written. The only way what I see is to use enquire.js, but I want to know if there isn't another way.
$(function() {
// Screen width check
if (matchMedia) {
var mq = window.matchMedia("(min-width: 992px)");
mq.addListener(WidthChange);
WidthChange(mq);
}
// Run function mq (check screen width)
function WidthChange(mq) {
// Screen size +992px
if (mq.matches) {
.....
}
// Screen size -992px
else {
.....
}
// End widthChange(mq) function
}
// End Function script
});
So this code will only check for min-width: 992px, but now I want atleast 3 more.