bootstrap-screensize
v1.0.6
Published
Angular v1.X module for screen width/height and Bootstrap's breakpoints
Downloads
505
Maintainers
Readme
bootstrap-screensize
Angular v1.x module for screen width/height and Bootstrap's breakpoints. Updates the properties on screen resize. Configure the debounce rate for performance requirements.
// default debounce rate
bsScreenSize.config({debounce:100});
});
angular .module('app', ['bs.screenSize']) .controller('testCtrl', function($rootScope, bsScreenSize){ // bsScreenSize is an optional dependency
// responsive properties, updates on screen resize
bsScreenSize.state; // 'xs','sm','md' or 'lg'
bsScreenSize.width; // 1200
bsScreenSize.height; // 800
// static functions
bsScreenSize.isScreenXs(); // bool
bsScreenSize.isScreenSm(); // bool
bsScreenSize.isScreenMd(); // bool
bsScreenSize.isScreenLg(); // bool
var state = bsScreenSize.currentState(); // 'xs','sm','md' or 'lg'
var width = bsScreenSize.currentWidth(); // 1200
var height = bsScreenSize.currentHeight(); // 800
// also available in the $rootScope for convenience
$rootScope.bsScreenSize.state; // 'xs','sm','md' or 'lg'
$rootScope.bsScreenSize.width; // 1200
$rootScope.bsScreenSize.height; // 800
});