thierry-b
6/11/2015 - 11:08 AM

JS Breakpoint detection

JS Breakpoint detection

/**
 * API to get the current computed CSS styles applied to an element.
 * This may be the current value applied by an animation or as set by a stylesheet.
 * 
 * Important: IE8 does not support getComputedStyle, you can use a polyfill 
 * http://snipplr.com/view/13523/
 */
if (window.getComputedStyle) {
  var breakpoint = window.getComputedStyle(document.body, ':after').getPropertyValue('content');
  // Tidy up after inconsistent browsers (some include quotation marks, they shouldn't)
  breakpoint = breakpoint.replace(/"/g, "");
  breakpoint = breakpoint.replace(/'/g, "");
}