Add optional support for matchMedia#126
Add optional support for matchMedia#126jpederson wants to merge 5 commits intodavatron5000:masterfrom
Conversation
…guments as Paul Irish's original function. Still runs if matchMedia isn't found.
|
Had to make a couple quick updates to clean up my code. Let me know if there's anything else you see needing to be done in order for this to be included. |
…ple in the main file.
|
Fixes made to readme to use single quotes. |
|
Hey! Just wanted to say I like this. Might be a bit before I have time to pull the branch, QA it and merge it all in. But this is a pretty sweet feature. That ternary + min/max super loop thing we have going on may need some cleaning up, but don't worry about it right now. Cleaning up that min/max stuff has been in the back of my brain for awhile. Thanks! And hopefully I can get to this soon. |
|
Cool, glad you like it, Dave! By the way, love your podcast, long time listener! |
|
As far as the ternary, my initial commit has my logic a little more expanded so its more legible (before I made it all one line for file size sake). We can roll back to that version of that chunk of code if you like - it'd also provide the opportunity to output a console message to let devs know if/when matchMedia is asked for, but not found. That part is unnecessary, but convenient and wouldn't add a lot of file size. Up to you! It's a pretty small detail, and that line of code executes quite quickly and is pretty efficient (it's just not as easy/convenient for humans to read), so it may not need adjustment to be honest, but happy to revisit it - let me know your preference. |
Uses Paul Irish's original
matchMediafunction if it's available, and takes a string as a plugin option of the same name. Still runs if matchMedia isn't found. Added usage instructions to the readme and an example line in the demo file. I chose to accept all the same arguments as matchMedia because it was easy, and enables things likematchMedia: 'tv'and orientation-based fitText viamatchMedia: 'all and (orientation:landscape)', etc.