Breakpoints is a light weight jQuery library to detect and manage breakpoint changes. Breakpoint was originally written to optimize large single page sites with too many binds on resize
causing performance issues. While still achieving the previous goal it has also been re-written to assist with general breakpoint management.
Include breakpoints library after jQuery, then initialize globally or on any page you want to use breakpoints.
<head>
<script src="./scripts/jquery.min.js"></script>
<script type="text/javascript" src="./scripts/jquery.breakpoints.min.js"></script>
</head>
$(document).ready(function() {
$(window).breakpoints();
});
Breakpoints will trigger breakpoint-change
when the viewport enters a new breakpoint. The returned event will include from
and to
on event indicating the previous and new breakpoint.