Press "Enter" to skip to content

jQuery Responsive / Breakpoint Optimized Library

A Breakpoint is a lightweight jQuery library for detecting and managing breakpoint changes. Breakpoint was originally written to optimize for large one-page sites with too many links to resize causing performance issues. While it still achieves the previous goal, it has also been rewritten to help manage generalĀ breakpoints.

jquery media query, set breakpoint in jquery, jquery responsive, jquery with, clientwidth jquery, jquery window width, javascript get bs breakpoint

How to make use of it:

1. Install jQuery Breakpoints with NPM:

$ npm install jquery-breakpoints --save

2. Alternatively, you can also download and insert a JavaScript file.

<script src="" 
<script src="jquery.breakpoints.min.js"></script>

3. Configure the plugin and we are ready to go.




4. Run a function when the breakpoint changes.

$(window).bind("breakpoint-change", function(event) {

$(window).bind("breakpoint-change", function(event) {
  if (event.from === "md") {
    // ...

  if ( === "md") {
    // ...

5. Preset breakpoints.

  breakpoints: [
    {"name": "xs", "width": 0},
    {"name": "sm", "width": 768},
    {"name" : "md", "width": 992},
    {"name" : "lg", "width": 1200}

6. Compare breakpoints and perform certain functions.

$(window).on('lessThan-md', function() {
  // Do something when viewport is less than 992px

7. API methods.

// Returns the current breakpoint name.

// Returns the current breakpoint width

// Destroys the plugin

8. More plugin options.

  // A buffer is set before breakpoints trigger breakpoint-change. 
  // The buffer keeps resizing more performant by not triggering actions prematurely.
  buffer: 300,

  // On initializing Breakpoints after the buffer trigger a breakpoint-change so all bindings necessary could happen. 
  // This will return the same event object as regular breakpoint change with event.initalInit.
  triggerOnInit: false,

  // Use $(window).outerWidth() over the default $(window).width() for window width calculations.
  outerWidth: false

Execute Functions Within Certain Breakpoints Plugin/Github, how to set window width in jquery

See Demo And Download

Official Website(jerrylow): Click Here

This superior jQuery/javascript plugin is developed by jerrylow. For extra Advanced Usages, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *