WickyNilliams / enquire.js

Awesome Media Queries in JavaScript
http://wicky.nillia.ms/enquire.js/
MIT License
3.62k stars 269 forks source link

Display Current Media Query #146

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi Nick, trying to display the current media query on the page. reference

Perhaps you could help out or point in the right direction?

Just learning all this and during development it would help me super lots to have a simple div with the current media query range displayed, e.g. appended to the body.

WickyNilliams commented 8 years ago

You could create a simple helper function, which wraps your listener object and adds/removes an element from the DOM on match/unmatch. Something like this: https://jsfiddle.net/e1agyhtn/

ghost commented 8 years ago

Been pullig my hair over this and will learn tons from your fiddle. Thank you so much!!