Skip to content

Instantly share code, notes, and snippets.

@ginsterbusch
Last active June 25, 2016 10:24
Show Gist options
  • Save ginsterbusch/47f076901e4cef617ced0c986e8a43ed to your computer and use it in GitHub Desktop.
Save ginsterbusch/47f076901e4cef617ced0c986e8a43ed to your computer and use it in GitHub Desktop.
Flexbox fallback for IE. Detect IE using the CSS DOM API (method: supports) and if so, load + init jquery-match-height
jQuery( function() {
/**
* IE 6 - 11 does not support the @methods supports of the CSS DOM API. Opera Mini + UC Browser for Android do not, too.
* IE Edge does, though.
* Uses jquery-match-height as flexbox fallback => @link https://github.com/liabru/jquery-match-height
*/
_isIE = ( typeof( window.CSS.supports ) == false );
_isMobile = ( jQuery('html').hasClass('mobile') ); // via headjs
if( _isIE != false ) {
/**
* load + init equal heights JS
* NOTE: _practical is a global options variable supplied by WP (wp_localize_script) for the theme I'm currently developing
*/
if( typeof( _practical ) != 'undefined' && typeof( _practical.matchheight_url ) != 'undefined' && !_isMobile ) {
jQuery.getScript( _practical.matchheight_url , function( data, status, jqxhr ) {
// add for .box / .box-row on front page / home page
jQuery('.box-list .box-row .box').matchHeight();
});
}
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment