bootstrap-detect-breakpoint

Detect the current Bootstrap 4 breakpoint in JavaScript.

Usage no npm install needed!

<script type="module">
  import bootstrapDetectBreakpoint from 'https://cdn.skypack.dev/bootstrap-detect-breakpoint';
</script>

README

bootstrap-detect-breakpoint

Detect the current Bootstrap 4 breakpoint in JavaScript.

Usage

Include the bootstrap-detect-breakpoint.js.

<script src="/src/bootstrap-detect-breakpoint.js"></script>

Get the current breakpoint with

var currentBreakpoint = bootstrapDetectBreakpoint() 

which will return an object with the current breakpoint name and index, like this

{
    "name": "lg",
    "index": 3
}

The index goes from 0 to 4, where 0 is "xs" and 4 is for "xl".