All Projects → Johann-S → bs-breakpoints

Johann-S / bs-breakpoints

Licence: MIT license
A plugin which detect Bootstrap 4 breakpoints and emit when there is a change

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to bs-breakpoints

Bs Stepper
A stepper for Bootstrap 4.x
Stars: ✭ 261 (+1086.36%)
Mutual labels:  vanilla-javascript, bootstrap4, vanilla-js, bootstrap-4, vanillajs
Bs Custom File Input
A little plugin for Bootstrap 4 custom file input
Stars: ✭ 162 (+636.36%)
Mutual labels:  vanilla-javascript, bootstrap4, vanilla-js, vanillajs
vanillajs-hello
Start a VanillaJS website using WebPack in just 30 seconds: HTML,CSS,Babel,SASS,Bootstrap,Prettier,Gitpod
Stars: ✭ 24 (+9.09%)
Mutual labels:  vanilla-javascript, vanilla-js, vanillajs
tensorflowjs-remove-background
Remove Background from the picture using WebAssembly & TensorFlow.js
Stars: ✭ 79 (+259.09%)
Mutual labels:  vanilla-javascript, vanilla-js, vanillajs
Learn Vanilla Js
Open source list of paid & free resources to learn vanilla JavaScript
Stars: ✭ 945 (+4195.45%)
Mutual labels:  vanilla-javascript, vanilla-js, vanillajs
Basictable
Basic Table jQuery or Vanilla JS plugin for simple responsive tables.
Stars: ✭ 94 (+327.27%)
Mutual labels:  breakpoint, vanilla-js, vanillajs
Vanilla Ui Router
Simple vanilla JavaScript router
Stars: ✭ 42 (+90.91%)
Mutual labels:  vanilla-javascript, vanilla-js, vanillajs
Vanillajs Deck
A Vanilla.js Single Page App (SPA) slide deck for a presentation about Vanilla.js written with no frameworks.
Stars: ✭ 119 (+440.91%)
Mutual labels:  vanilla-javascript, vanilla-js, vanillajs
add-to-calendar-button
A convenient JavaScript snippet, which lets you create beautiful buttons, where people can add events to their calendars.
Stars: ✭ 697 (+3068.18%)
Mutual labels:  vanilla-js, vanillajs
hugo-lime
Hugo Lime is a business theme for GoHugo by https://uicard.io
Stars: ✭ 31 (+40.91%)
Mutual labels:  bootstrap4, bootstrap-4
event-driven-web-components-realworld-example-app
Exemplary real world application built with Vanilla JS Web Components in an Event Driven Architecture
Stars: ✭ 55 (+150%)
Mutual labels:  vanilla-javascript, vanilla-js
mm-components
Music Markups components
Stars: ✭ 50 (+127.27%)
Mutual labels:  vanilla-javascript, vanilla-js
svelte-googlemaps
Svelte Google Maps Components
Stars: ✭ 62 (+181.82%)
Mutual labels:  vanilla-javascript, vanillajs
eins-modal
Simple to use modal / alert / dialog / popup. Created with pure JS. No javascript knowledge required! Works on every browser and device! IE9
Stars: ✭ 30 (+36.36%)
Mutual labels:  vanilla-javascript, vanilla-js
coding challenge-14
Understanding JavaScript and coding without the help of a library or tool
Stars: ✭ 22 (+0%)
Mutual labels:  vanilla-javascript, vanilla-js
startbootstrap-logo-nav
A Bootstrap navigation template with a logo in the navigation bar - created by Start Bootstrap
Stars: ✭ 65 (+195.45%)
Mutual labels:  bootstrap4, bootstrap-4
MPACore.PhoneBook
采用MVC+jQuery 的方式进行开发。
Stars: ✭ 51 (+131.82%)
Mutual labels:  bootstrap4, bootstrap-4
breaking-point
BREAKING-POINT lets you quickly define and subscribe to screen (i.e. window) breakpoints in your re-frame application
Stars: ✭ 36 (+63.64%)
Mutual labels:  breakpoint, breakpoints
startbootstrap-1-col-portfolio
A one column Bootstrap HTML portfolio template - created by Start Bootstrap
Stars: ✭ 60 (+172.73%)
Mutual labels:  bootstrap4, bootstrap-4
tablist
WAI-ARIA tab plugin without dependencies.
Stars: ✭ 21 (-4.55%)
Mutual labels:  vanilla-javascript, vanilla-js

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

CDN Link
jsDelivr https://cdn.jsdelivr.net/npm/bs-breakpoints/dist/bs-breakpoints.js
jsDelivr, minified https://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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].