Skip to content

Instantly share code, notes, and snippets.

@BracketBulldog
BracketBulldog / breakpoint-detection.js
Created January 28, 2015 16:13
Ultra compact Bootstrap breakpoint detection with jQuery (Dirty)
var cw, pcw;
$(window).on('load resize', function () {
// get width as int
cw = parseInt($('.container').css('width'));
// make 'current !== previous' equation easier
if (cw < 750) {cw = 'xs';}
// execute breakpoint-specific action if the current container width is not the same as the previous one
if (cw !== pcw) {
@BracketBulldog
BracketBulldog / detect-flexbox-and-flexwrap-support
Created January 10, 2015 21:58
How to detect browser support for flexbox and flexwrap
// how to detect flexbox support
// create a test div in the DOM
var div = document.createElement('div');
// make sure the default value is display: block
div.style.display = 'block';
// try some display values invoking flexbox
try {