📜 ⬆️ ⬇️

BiMap, jQuery breakpoint

Bimap


BiMap (GitHub: alethes / bimap , License: MIT , npm: bimap ) from James Daab is a bidirectional implementation of such a data structure as a map. This implementation allows you to access the value through keys and vice versa to keys through values:
bimap.push({ a: { b: 1, c: { d: 2 } } }); bimap.key('a.b'); // => 1 bimap.val(2); // => "acd" 

jQuery breakpoint


jQuery breakpoint (GitHub: joshbambrick / breakpoint , License: MIT ) from Joshua Bambrick, is an extension that responds to page size changes. This is the perfect solution if you need to respond from javascript to resizing the page when working with responsive design.

You can bind handlers to $.breakpoint.on , which is also capable of accepting an array in order to respond to different, predefined, dimensions (resolutions) of the device. Also, there is $.breakpoint.off to remove handlers and $.breakpoint.changeBreakpoints to change globally recognized (installed) device sizes (permissions).

$ .breakpoint.on

 var makeChanges = function (breakpointName) { if (breakpointName === 'palm') { // make changes for mobile } else if (breakpointName === 'lap') { // make changes for small screen width } else { // `breakpointName` is 'default' as the new page width matches neither 'palm' nor 'lap' } }; $.breakpoint.on(['palm', 'lap'], makeChanges); 

$ .breakpoint.off

 $.breakpoint.off(makeChanges); 

$ .breakpoint.changeBreakpoints

 { palm: { max: 719 }, lap: { max: 1023, min: 720 }, 'lap-and-up': { min: 720 }, portable: { max: 1023 }, desk: { min: 1024 } } 

')

Source: https://habr.com/ru/post/237083/


All Articles