Skip to content

Instantly share code, notes, and snippets.

@toddzebert
Last active February 10, 2017 06:57
Show Gist options
  • Save toddzebert/471ee65b8553878dc993b7484edd3d0b to your computer and use it in GitHub Desktop.
Save toddzebert/471ee65b8553878dc993b7484edd3d0b to your computer and use it in GitHub Desktop.
Sharing CSS breakpoints with JavaScript - Demo JavaScript
$(function() {
bodyBP = bpExport.breakpoint('body');
bodyBP.onChange(function(bp) {
$('.my-site-breakpoint').html(bp);
});
myDivBP = bpExport.breakpoint('.my-div');
myDivBP.onChange(function(bp) {
$('.my-div-breakpoint').html(bp);
});
myDivBP.onChange(function(bp) {
if (bp === "just-right") {
$('.my-color-div').css('background-color', '#0000ff');
} else {
$('.my-color-div').css('background-color', '#ff0000');
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment