Current collected state Current
Observed since 20 Oct, 22:15 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
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.
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 22:15 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:a64f5c3ebc684fd2d3ecf07014d66966c2743c0aa2af7c76cd245db6f6afa6ba