@teamthunderfoot/breakpoints

0.0.83 • Public • Published

Breakpoints.js Documentation

breakpoints.js is a JavaScript module for managing responsive design breakpoints. It provides functions for calculating the current breakpoint based on the screen width and dynamically updating the current breakpoint on window resize.

Installation

npm i @teamthunderfoot/breakpoints

Usage

Importing the Module

import { breakpoints, currentBreakpoint, getCurrentBreakpoint, updateBreakpointOnResize } from '@teamthunderfoot/breakpoints';

Breakpoints

let bk = breakpoints.reduce((target, inner) => Object.assign(target, inner), {})
console.log(bk.mobile)

Using currentBreakpoint:

let screenWidth = window.innerWidth; 
let currentBreakpoint = getCurrentBreakpoint(screenWidth);
console.log('Current Breakpoint:', currentBreakpoint);

Updating the Current Breakpoint:

// Add event listener for screen resize
window.addEventListener('resize', () => {
    let currentBreakpoint = updateBreakpointOnResize();
    console.log('Current Breakpoint:', currentBreakpoint);
});

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.83
    5
    • latest

Version History

Package Sidebar

Install

npm i @teamthunderfoot/breakpoints

Weekly Downloads

15

Version

0.0.83

License

ISC

Unpacked Size

2.75 kB

Total Files

3

Last publish

Collaborators

  • amaia9
  • nereafontecha
  • andresclua