Created
March 30, 2019 17:04
-
-
Save thelevicole/21cc96b5778169cb0e23fae49a47e11a to your computer and use it in GitHub Desktop.
Access Bootstrap breakpoints in via Javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const styles = getComputedStyle( document.body ); | |
/** | |
* Get the globally set bootstrap breakpoints | |
* | |
* @type {object} | |
*/ | |
const breakpoints = { | |
xs: parseInt( styles.getPropertyValue( '--breakpoint-xs' ) ), | |
sm: parseInt( styles.getPropertyValue( '--breakpoint-sm' ) ), | |
md: parseInt( styles.getPropertyValue( '--breakpoint-md' ) ), | |
lg: parseInt( styles.getPropertyValue( '--breakpoint-lg' ) ), | |
xl: parseInt( styles.getPropertyValue( '--breakpoint-xl' ) ) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now implemented into its own library. https://github.com/thelevicole/breakpoints.js