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

bootstrap-detect-breakpoint

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bootstrap-detect-breakpoint

Detect the current Bootstrap breakpoint in JavaScript

  • 1.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
94
increased by77.36%
Maintainers
1
Weekly downloads
 
Created
Source

bootstrap-detect-breakpoint

Detect the current Bootstrap breakpoint in JavaScript.

  • Demo Page
  • npm Package

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 5, where 0 is "xs" and 5 is for "xxl".

Works in Bootstrap 4 and Bootstrap 5 from version 5.3

In Bootstrap 5 prior 5.3 there is an issue that the css variables for breakpoints are missing. I already created a pull request, and it will be merged with version 5.3. 🥳

Up to version 5.3, you can use the bootstrap-detect-breakpoint script with Bootstrap 5 by simply adding the following to your scss

:root {
  @each $name, $value in $grid-breakpoints {
    --bs-breakpoint-#{$name}: #{$value};
  }
}

Keywords

FAQs

Package last updated on 12 Apr 2023

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