Socket
Socket
Sign inDemoInstall

bs-breakpoints

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bs-breakpoints

A plugin which detect Bootstrap 4 breakpoints and emit when there is a change


Version published
Weekly downloads
1.2K
decreased by-0.24%
Maintainers
1
Install size
27.5 kB
Created
Weekly downloads
 

Changelog

Source

1.1.1 (2019-07-04)

Bug Fixes

  • core: detection at the edges of breakpoints min limits (beecfa2)
  • core: use only "jQuery" global var to detect jQuery (f50fcca)
  • docs: add new feature in the features list (61cde13)
  • release: add changelog file in distributed files (d5f7bae)

<a name="1.1.0"></a>

Readme

Source

bs-breakpoints

npm version dependencies Status devDependencies Status Build Status JavaScript Style Guide JS gzip size

A plugin which detect Bootstrap 4 breakpoints and emit when there is a change.

You can use it on React and Angular too because this plugin is written with the most used JavaScript framework: VanillaJS.

Features:

  • Works with Bootstrap 4
  • Works without dependencies and jQuery
  • Can work with jQuery if detected
  • Detect custom breakpoints in CSS properties
  • Built in UMD to be used everywhere
  • Small, only 2kb and less if you gzip it

Table of contents

Install

With npm or yarn

npm install bs-breakpoints --save

// yarn
yarn add bs-breakpoints

CDN

CDNLink
jsDelivrhttps://cdn.jsdelivr.net/npm/bs-breakpoints/dist/bs-breakpoints.js
jsDelivr, minifiedhttps://cdn.jsdelivr.net/npm/bs-breakpoints/dist/bs-breakpoints.min.js

How to use it

You should wait for the document ready event and call the init method to detect breakpoint changes. We expose one global variable available everywhere: bsBreakpoints

Vanilla JS

document.addEventListener('DOMContentLoaded', function () {
  bsBreakpoints.init()
})

With jQuery

$(document).ready(function () {
  bsBreakpoints.init()
})

Use it with npm

import bsBreakpoints from 'bs-breakpoints'

For more examples check out this file.

This library is UMD ready so you can use it everywhere.

Methods

init

Will detect the current breakpoint and emit init.bs.breakpoint event.

It'll add a listener on the window resize event and emit new.bs.breakpoint event.

detectBreakpoint

Detect the current breakpoint and return it.

getCurrentBreakpoint

Return the current breakpoint.

Events

init.bs.breakpoint

Emitted just once when bsBreakpoints.init() is called.

This event contains the current breakpoint in the detail attribute in VanillaJS and for those who use jQuery we add a breakpoint key in jQuery's events.

new.bs.breakpoint

This event is emitted when there is a breakpoint changes.

This event contains the current breakpoint in the detail attribute in VanillaJS and for those who use jQuery we add a breakpoint key in jQuery's events.

Support me

If you want to thank me, you can support me and become my Patron

License

MIT

Keywords

FAQs

Last updated on 04 Jul 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc