weblinc/media-match

Doesn't seem to be working in IE 8...

babyewok opened this issue · 4 comments

This doesn't seem to be working in IE8 for me. Is there something I am missing? This is my script (stripped down from what I really want to do just to test it out):

jQuery("ul#jMenu").removeClass("noscript");
var mql = window.matchMedia("screen and (min-width: 768px)");
if (mql.matches) {
jQuery("ul#jMenu").addClass("jMenu");
}
else {
jQuery("ul#jMenu").addClass("rMenu");
}

but it seems to just do the else statement, regardless of screen size!

If I do this:

jQuery("ul#jMenu").removeClass("noscript");
var mql = window.matchMedia("screen and (min-width: 768px)");
.addListener(function(mql) {
if (mql.matches) {
jQuery("ul#jMenu").addClass("jMenu");
}
else {
jQuery("ul#jMenu").addClass("rMenu");
});

It doesn't even remove the noscript class despite being outside the mql.matches if statement

Please help!

Ooooh I see. It seems to be because I am using respond.js for the css media queries. How can I get these two working together? Or is there another polyfill for css media queries that works with media-match.js?

I know respond.js can deal with match media but not event listeners which I really want to use....

Aha! I seem to be answering all my own questions here! I needed to remove the part that deals with match media from respond.js. All good now! media-match.js is a great script for whipping IE in to shape - good job!

@babyewok

You got it. Good work powering through.
Thanks, it's great to hear that this project is helping.

Happy coding

User solved there own issue. Thanks user.