Skip to content

Instantly share code, notes, and snippets.

@alex-quiterio
Forked from josetapadas/gist:f9eec8ca7d9f214f0918
Last active August 29, 2015 14:28
Show Gist options
  • Save alex-quiterio/c1642b78918da9479439 to your computer and use it in GitHub Desktop.
Save alex-quiterio/c1642b78918da9479439 to your computer and use it in GitHub Desktop.
Dynamic single shot media query
var mediaQueryListElement = window.matchMedia("all and (min-width: 666px)");
function call_me(name) {
console.log("És um " + name);
mediaQueryListElement.removeListener(call_me.caller);
}
mediaQueryListElement.addListener(function() {
call_me("sugar");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment