Skip to content

Instantly share code, notes, and snippets.

@thatjeannie
Created April 21, 2015 17:18
Show Gist options
  • Save thatjeannie/444cc6485bf98963a584 to your computer and use it in GitHub Desktop.
Save thatjeannie/444cc6485bf98963a584 to your computer and use it in GitHub Desktop.
Media Queries in JavaScript (attempt)
$(document).ready(function() {
// THIS IS SO CONFUSING!
if ($(window).width() >= 380) {
// NEST!
if ($(window).width() >= 680) {
// NEST AGAIN!
if ($(window).width() >= 768) {
// LAST TIME!
if ($(window).width() >= 1200) {
// stuff for big screens
console.log("up to BIG WINDOWS - >= 1200");
}
// stuff for tablet->laptop screens
console.log("up to LAPTOP WINDOWS - >= 768");
}
// stuff for big phones and landscape
console.log("up to BIG PHONE WINDOWS - >= 680");
}
// stuff for small phones and portrait
console.log("up to SMALL PHONE WINDOWS - >= 380");
}
}); // end doc ready
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment