0.1.5 • Published 5 years ago

libmq v0.1.5

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

libmq

A simple Javascript media query library for web browsers.

coverage size

Install

$ npm install libmq --save

About

This module runs media queries on either the window's width/height or a provided value.

Example

import { query, screenWidths as w } from 'libmq'

if ( query.desktopUp()) 
  console.log( `Width is at least ${ w.desktopUp }`)

else if ( query.phoneOnly())
  console.log( `Width is no more than ${ w.phoneOnly }`)

if ( query.desktopUp( w.bigDesktopUp ))
  console.log( "This module isn't broken." )

API

Each method tests window.innerWidth or a provided value against the following conditions:

  • bigDesktopUp() - Above 1800px
  • desktopUp() - Above 1200px
  • phoneOnly() - Below 599px
  • tabletPortraitDown() - Below 899px
  • tabletPortraitUp() - Above 600px
  • tabletLandscapeDown() - Below 899px
  • tabletLandscapeUp() - Above 600px
  • landscape() - Greater than or equal to window.innerHeight
  • portrait() - Less than window.innerHeight
0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago