Revision: 70467
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 26, 2016 21:44 by dhjapan
Initial Code
/* Manage viewport behavior */ +function ($, viewport) { 'use strict'; window.BpUtils= { // add a callback to call on every breakpoint switch // callback is call this viewport as argument // more about viewport : https://github.com/maciej-gurban/responsive-bootstrap-toolkit newBreakpointRulesList: [], addCallBack: function(rule) { this.newBreakpointRulesList.push(rule); }, applyNewBreakpointRules: function (viewport) { if(this.newBreakpointRulesList.length == 0) { return; } $.each(this.newBreakpointRulesList, function(i, rule){ rule(viewport); }); }, // Listen viewport changes currentbp: '', onUpdateViewport: function() { var bp = viewport.current() ; if (bp.length != 2) { // if breakpoint not detected yet setTimeout(window.BpUtils.onUpdateViewport, 20); return; } // if (bp != this.currentbp) { this.currentbp = bp; window.BpUtils.applyNewBreakpointRules(viewport); } } }; // on resize $(window).resize( viewport.changed(function() { window.BpUtils.onUpdateViewport(); }) ); window.BpUtils.onUpdateViewport(); }(jQuery, ResponsiveBootstrapToolkit);
Initial URL
Initial Description
ResponsiveBootstrapToolkit : https://github.com/maciej-gurban/responsive-bootstrap-toolkit
Initial Title
Bootstrap javascript breakpoint utils
Initial Tags
javascript
Initial Language
JavaScript