nucliweb
1/20/2016 - 10:25 PM

Media-queries JS

Media-queries JS

// MEDIA QUERIES
// ----------------------------------------------------------------------------
function displayIsBiggerThanBreakpoint(bp) {
  var displayWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
  return displayWidth >= bp;
}

function isMobile() {
  return !displayIsBiggerThanBreakpoint(320);
}

function isMobileLandscapeAndUp() {
  return displayIsBiggerThanBreakpoint(320);
}

function isTabletAndUp() {
  return displayIsBiggerThanBreakpoint(480);
}

function isDesktopAndUp() {
  return displayIsBiggerThanBreakpoint(768);
}

function isWidescreenAndUp() {
  return displayIsBiggerThanBreakpoint(970);
}