Detect the current Bootstrap breakpoint in JavaScript

Overview

bootstrap-detect-breakpoint

Detect the current Bootstrap 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 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. I already created a pull request, but I don't know when or if it will be merged.

Until then you can make the bootstrap-detect-breakpoint script work with Bootstrap 5 by just adding this to your scss

:root {
  @each $name, $value in $grid-breakpoints {
    --bs-breakpoint-#{$name}: #{$value};
  }
}
You might also like...

Browser In The Browser (BITB) attack is a sophisticated phishing and hard to detect.

Browser In The Browser (BITB) attack is a sophisticated phishing and hard to detect.

BITB Browser In The Browser (BITB) attack is a sophisticated phishing and hard to detect. Goto: ๐Ÿ‘‰ MacOS-Chrome-DarkMode ๐Ÿ‘‰ MacOS-Chrome-LightMode ๐Ÿ‘‰

Dec 4, 2022

This project will be using various AI and Rule Engine algorithm to detect various attack against a company!

This project will be using various AI and Rule Engine algorithm to detect various attack against a company!

๐Ÿ“Œ Introduction This project will be using various AI and Rule Engine algorithm to detect various attack against a website! ๐Ÿ“Œ Mission After starting

Apr 29, 2022

Detect webpage updates and notify user to reload. support vite and umijs

English | ็ฎ€ไฝ“ไธญๆ–‡ plugin-web-update-notification Detect webpage updates and notify user to reload. support vite and umijs. Take the git commit hash as th

Dec 26, 2022

Yet another linter rule to detect compatibility of CSS features.

Yet another linter rule to detect compatibility of CSS features.

stylelint-browser-compat Yet another linter rule to detect compatibility of CSS features. This plugin checks if the CSS you're using is supported by t

Dec 15, 2022

UAParser.js - Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data. Supports browser & node.js environment.

UAParser.js - Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data. Supports browser & node.js environment.

UAParser.js JavaScript library to detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data with relatively small footprint (~17KB m

Jan 4, 2023

Detect browser, and render view according to the detected browser type.

react-browser-detector Detect browser, and render view according to the detected browser type. Installation To install, you can use npm or yarn: npm i

Jul 13, 2022

๐Ÿฆ ๐Ÿ”ฌ Forta agent that detect deployment of smart contracts containing an exploit function

Attack Simulation Bot Description The agent detects deployment of smart contracts containing an exploit function. Using a simulation-based approach, t

Dec 26, 2022

Detect F12 open console, protect web static resources, support redirect, rewrite, callback strategies.

console-ban Detect F12 open browser console. protect web site static resources, support redirect, rewrite, custom callback strategies. Language: Engli

Dec 26, 2022

Weather app created using vanilla JavaScript and APIs. You can search cities worldwide and get current and forecast weather features.

Weather app created using vanilla JavaScript and APIs. You can search cities worldwide and get current and forecast weather features.

Weather App Live Demo About the Project Weather app created using vanilla JavaScript and APIs. You can search cities worldwide and get current and for

Dec 28, 2022
Owner
Stefan Haack
My code is your code
Stefan Haack
Extends Bootstrap Tooltips and Popovers by adding custom classes. Available for Bootstrap 3 and Bootstrap 4.

Bootstrap Tooltip Custom Class Extends Bootstrap Tooltips and Popovers by adding custom classes. Available for Bootstrap 3 and Bootstrap 4. Define you

Andrei Victor Bulearca 14 Feb 10, 2022
A simple Form Validation Utility for Bootstrap 3, Bootstrap 4, and Bootstrap 5 for Humans.

bootstrap-validate A simple Form Validation Utility for Bootstrap 3, Bootstrap 4, and Bootstrap 5 for Humans. ?? Support us with Developer Merchandise

null 138 Jan 2, 2023
Device.js is a JavaScript library to detect device, viewport, and browser information using plain JavaScript.

Device.js Device.js is a JavaScript library to detect device, viewport, and browser information using plain JavaScript. Compatibility Works with all m

Emanuel R. Vรกsquez 5 Dec 16, 2022
Bootstrap Colorpicker is a modular color picker plugin for Bootstrap.

Bootstrap Colorpicker Bootstrap Colorpicker is a modular color picker plugin for Bootstrap 4. THIS PROJECT IS NOT MAINTAINED ANYMORE. After almost 10

Javi Aguilar 1.4k Dec 22, 2022
Detect npm packages by author name in your package-lock.json or yarn.lock.

detect-package-by-author Detect npm packages by author name in your package-lock.json or yarn.lock. Install Install with npm: # Not Yet Publish # npm

azu 2 Jan 11, 2022
Detect Kakaotalk in-app browser

Detect Kakaotalk in-app browser Languages ํ•œ๊ตญ์–ด | English Introduce I'm so tired by the in-app browser. Install npm i detect-kakaotalk-in-app-browser #

Juunini (์ฅฌ๋‹ˆ๋‹ˆ) 16 Sep 1, 2022
A lightweight extension to automatically detect and provide verbose warnings for embedded iframe elements in order to protect against Browser-In-The-Browser (BITB) attacks.

Enhanced iFrame Protection - Browser Extension Enhanced iFrame Protection (EIP) is a lightweight extension to automatically detect and provide verbose

odacavo 16 Dec 24, 2022
You can detect requested client full IP details with this package. (isp, organization, location, residential/data center, proxy, etc)

requested client ip details Install the package npm npm install @sarequl/client-ip-details yarn yarn add @sarequl/client-ip-details example with expr

Sarequl Basar 8 Oct 13, 2022
Detect if a contract has been deployed in the latest (or predefined) block from an address that was previously funded through Tornado.Cash.

??๏ธโ€โ™‚๏ธ TORN Detector Detect if a contract has been deployed in the latest (or predefined) block from an address that was previously funded through Tor

Pascal Marco Caversaccio 14 Dec 24, 2022
Detect the executable python interpreter cmd in $PATH.

detect-python-interpreter Detect the executable python interpreter cmd in $PATH. Installation $ npm install --save detect-python-interpreter Usage con

Khaidi Chu 2 Apr 12, 2022