Evaluate Media Query and Event #131

mdmoura opened this Issue Jun 14, 2012 · 1 comment

2 participants



I have been trying to evaluate a Media Query using Respond and Match Media but no luck.

I have an image on my page: "Chart_200_by_400.jpg".

When the windows is resized and the following Media Query is satisfied:

if (matchMedia('only screen and (max-width: 480px)').matches) {
   // RESIZE IMAGE to "Chart_100_by_200.jpg".

Is it possible to have something like this work with all browsers?

Thank You,


You'll want to use the matchMedia addListener polyfill for this -- https://github.com/paulirish/matchMedia.js/blob/master/matchMedia.addListener.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment