Bootstrap Detect Breakpoint Example

Download This Plugin Back To jQueryScript

A super tiny script that detects Bootstrap 5/4 breakpoints and returns an object containing the current breakpoint name ("xxl", "xl", "lg", "md", "sm", "xs") and index (0-5).

Current Breakpoint:

const output = document.getElementById("breakpoint-output")

function updateView() {
    const currentBreakpoint = bootstrapDetectBreakpoint()
    output.innerHTML = "" + JSON.stringify(currentBreakpoint) + ""
}

updateView()
window.onresize = updateView