https://github.com/wheeyls/jsmedia
Watch for Media Query changes in JavaScript code.
https://github.com/wheeyls/jsmedia
Last synced: 4 months ago
JSON representation
Watch for Media Query changes in JavaScript code.
- Host: GitHub
- URL: https://github.com/wheeyls/jsmedia
- Owner: wheeyls
- Created: 2012-02-07T04:37:08.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2012-02-09T03:47:42.000Z (over 13 years ago)
- Last Synced: 2024-12-31T12:52:08.894Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 93.8 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
jsMedia
=======This is a simple media-query plugin. I'm wrapping Nicholas Zakas' "isMedia" function (http://www.nczonline.net/blog/2012/01/19/css-media-queries-in-javascript-part-2/)
You can either query against the current media state directly with "isMedia," or else watch the window continuously with "watch" to respond to changes in the page's state.
Example
=======
$.jsMedia.isMedia("screen and (max-width: 500px)"); // true or false
$.jsMedia.watch("screen and (max-width: 500px)",
function(query) { /* fire on entering */ },
function(query) { /* fire on exiting */ }
);