Loops through all the min-width breakpoints and stores them in an array.
Creates a custom event called switch
, which gets fired when the breakpoint has changed.
The custom event provides the name of the breakpoint and width in pixels.
Each breakpoint name is in the following format: bp-{number}
.
See it in action + some notes! 😀
Example
ML.El.evt(window, 'switch', function(e) { console.log(e.detail.name); // name of the breakpoint console.log(e.detail.size); // width in px of breakpoint. });