Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ab-mediaquery

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ab-mediaquery

AB-mediaQuery is the JavaScript side of Media Queries. It proposes you some very useful methods for your scripts

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13
decreased by-7.14%
Maintainers
1
Weekly downloads
 
Created
Source

AB-mediaQuery

That's the JavaScript side of Media Queries. It proposes you some very useful methods for your scripts. That plugin is in vanilla JS, with no dependencies.

Demo: Codepen

NPM: https://www.npmjs.com/package/ab-mediaquery

npm install ab-mediaquery

The plugin is commonJS and AMD compliant.

Usage

You only need to call that function to create AB.mediaQuery object and bind the breakpoint 'watcher':

mediaQuery();

What you get

Return the current breakpoint. Can be 'tiny', 'small', 'medium', 'large' or 'huge':

AB.mediaQuery.current;

check if the current breakpoint is at least the specified one and return true/false:

AB.mediaQuery.atLeast('small');

'changed.ab-mediaquery' event is automatically triggered when breakpoint change:

window.addEventListener('changed.ab-mediaquery', function(){
  ...
});

You can list watched media queries generated by the plugin:

AB.mediaQuery.getQueries();

Return media query rule from breakpoint name:

AB.mediaQuery.get('small');

Keywords

FAQs

Package last updated on 05 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc