Current collected state Current
Observed since 20 Oct, 22:15 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
@0saw/foundation-media-query
Lightweight addon to suit your crazy frontend needs
Small little nifty utility to help you work with foundation-sites media queries.
No dependencies. Except for foundation (Da-a-ah). Adds CustomEvent polyfill.
import mq from "@0saw/foundation-media-query";
document.addEventListener('breakpoint-change', breakpointEventListener);
function breakpointEventListener() {
if (mq.is('large only')) {
console.log("You've hit the right spot");
}
}
You are not obligated to import mq to your scope. Instead you can use event.detail like so:
import "@0saw/foundation-media-query";
document.addEventListener('breakpoint-change', breakpointEventListener);
function breakpointEventListener(event) {
let mq = event.detail;
switch (mq.current) {
case 'medium':
alert("You've hit the right spot");
break;
case 'large':
alert("Too far");
break;
default:
break;
}
}
mq object contains a few useful things.
current - Gives you the name of current breakpointcurrentFull - Gives you all of the breakpoint info that we have. (I.e mq.currentFull.matchMedia will give you matchMedia object. In case you want to do something naughty)landscape - Analog of CSS's (orientation: landscape)portrait - Pretty straight forwardretina - DPI is at least 2xis - Allows you to quickly check current breakpoint// Either true or false
mq.is('xlarge');
// Won't return true when next breakpoint is active. ([small -> medium] -> large)
mq.is('medium only');
// portrait/ladscape/retina
mq.is('portrait');
@include foundation-global-styles;Download counts and popularity will appear here as the collector receives them.
Declarations describe requirements; they are not a resolved dependency graph.
Source distribution
{
"integrity": "sha512-9NmKB3IpInWuJrDLDVw2afxM1N9xkyOSgjWUzwVyaJkvgSQJqshecl8KhFsSrX89hWCrNZfBaVuQf2weRbw8jg==",
"shasum": "7b06cef6e026a0fb18e1d702b1b3877c443afe51",
"tarball": "https://registry.npmjs.org/@0saw/foundation-media-query/-/foundation-media-query-1.0.3.tgz",
"fileCount": 24,
"unpackedSize": 79092,
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc0VAmCRA9TVsSAnZWagAApFEP/1D6fM3Wf1TI9eDC3wg+\ndulZP5JZEL1IgF0yTaKhcF9EuFunUs+Op6tzbqy4BoqKigKA4c2DzTJAOv8Z\nn0y0NwiTLml4NQpEwB20JAe9ePc3CpI4VrlpkM2FKuT0HyrYYxKXmM7pJy/g\nD1kpc54JyBqB1YxyoafMxxA8TVsdLl60yGB33zmA4bgt66NFqmxA/ZKtst1V\nApMjMAEoJkObCh5HXytRaLngW4Jc0PXwa9f64uiIJ9J+pHwGL6D7vyo0RQhC\nM0xUwOQ31vZm6rcPGl9Z33Ndjtc2se4iVvgrucaPZcG0WU10mGkM467NmEKc\nwA8j8fQ3M07+Kp59+qJtm69/X3rPvvDKPG9jDkCaT6Kgf8THnQ/8XwjXkfOj\n3GW4NQDpVTTwC3/q3BgnwVXnydHg0zxyXHa27CFPdUQwc21tFNXvszzA+LGD\n26KLgDzcWPnkEoy8gDzG6iLhuMP/Qdww8MWfp7VkOtAASK3KofXa/404uNEl\nWI/8g5RkLeWcHnKWPzFEldUVsPCtt0sp7cUjSohToQcDegFao0I8dxt59Ml1\nRlswRkedoBMpiC5yLBHxcA4SB3dA0bQnz+n6lDKv/39R16clN2FWTYTPaaPY\nXJ6Wa26PWABPagFQ/aeieOcr4wux6sm8F8kgbNkz1oANRkLV8fhQK67xg6Tu\nUYIy\r\n=FHH9\r\n-----END PGP SIGNATURE-----\r\n",
"signatures": [
{
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
"sig": "MEYCIQDD6wr5ku9SxCdGvw8lrVdDt3iWe8cz6dYZ2U6+6S4bnwIhALHp6t7xrjsI6tlMVI6X5RPabvSY88eRRkzyB1NYRok0"
}
]
}Shared repository data · GitHub
Observed since 20 Oct, 22:15 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:a5844115015a4de3d44eb0ad45d8bcce7ec3a898e76873065be0dc158fdd4529