Skip to content

Instantly share code, notes, and snippets.

@toddzebert
Last active February 10, 2017 06:31
Show Gist options
  • Save toddzebert/f52e28083c882bda6681f3702a17f2e4 to your computer and use it in GitHub Desktop.
Save toddzebert/f52e28083c882bda6681f3702a17f2e4 to your computer and use it in GitHub Desktop.
Sharing CSS breakpoints with JavaScript - Demo SCSS
// set our site's breakpoints
$site-breakpoints: (
"small": 320px,
"medium": 460px,
"large": 969px,
"x-large": 1061px,
"xx-large": 1284px
);
@include add-bp($site-breakpoints);
// now apply to body:before
body:before {
@include bp-export();
}
// if you have other breakpoints you use elsewhere, you can use those too
$my-div-breakpoints: (
"too-small": 480px,
"just-right": 720px,
"too-big": 1200px
);
// sets the breakpoint to those in the map
@include add-bp($my-div-breakpoints);
// now apply to my div
.my-div:before {
@include bp-export($my-div-breakpoints)
}
// not functional, just make it look nice
.my-color-div {
height: 50px;
width: 50px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment