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 - npm Package Compare versions

Comparing version 1.1.1 to 1.1.3

LICENSE

2

package.json
{
"name": "bootstrap-detect-breakpoint",
"version": "1.1.1",
"version": "1.1.3",
"description": "Detect the current Bootstrap breakpoint in JavaScript",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -31,9 +31,9 @@ # bootstrap-detect-breakpoint

The index goes from 0 to 4, where 0 is "xs" and 4 is for "xl".
The index goes from 0 to 5, where 0 is "xs" and 5 is for "xxl".
## Get it working with Bootstrap 5
In Bootstrap 5 there is an [issue that the css variables for breakpoints are missing](https://github.com/twbs/bootstrap/issues/36094). I already created a [pull request](https://github.com/twbs/bootstrap/pull/36095), but I don't know when it will be merged.
In Bootstrap 5 there is an [issue that the css variables for breakpoints are missing](https://github.com/twbs/bootstrap/issues/36094). I already created a [pull request](https://github.com/twbs/bootstrap/pull/36095), but I don't know when or if it will be merged.
You can make this script work with just adding this to your scss
Until then you can make the bootstrap-detect-breakpoint script work with Bootstrap 5 by just adding this to your scss
```scss

@@ -40,0 +40,0 @@ :root {

@@ -0,1 +1,6 @@

/**
* Author and copyright: Stefan Haack (https://shaack.com)
* Repository: https://github.com/shaack/bootstrap-detect-breakpoint
* License: MIT, see file 'LICENSE'
*/
const bootstrapDetectBreakpoint = function () {

@@ -7,5 +12,5 @@ // cache some values on first call

const isPriorBS5 = !!window.getComputedStyle(document.documentElement).getPropertyValue('--breakpoint-sm')
const selector = isPriorBS5 ? "--breakpoint-" : "--bs-breakpoint-"
const prefix = isPriorBS5 ? "--breakpoint-" : "--bs-breakpoint-"
for (const breakpointName of this.breakpointNames) {
const value = window.getComputedStyle(document.documentElement).getPropertyValue(selector + breakpointName)
const value = window.getComputedStyle(document.documentElement).getPropertyValue(prefix + breakpointName)
if(value) {

@@ -12,0 +17,0 @@ this.breakpointValues[breakpointName] = value

Sorry, the diff of this file is not supported yet

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