forked from LiveCarta/LiveCartaWP
webp test
This commit is contained in:
@@ -72,7 +72,19 @@ require_once 'inc/walker-nav-menu.php';
|
||||
</script>
|
||||
<?php endif;?>
|
||||
|
||||
<script src="<?= get_theme_file_uri('/assets/js/modernizr-custom.js'); ?>"></script>
|
||||
<script>
|
||||
function support_format_webp() {
|
||||
var elem = document.createElement('canvas');
|
||||
if (!!(elem.getContext && elem.getContext('2d'))) {
|
||||
return elem.toDataURL('image/webp').indexOf('data:image/webp') == 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (support_format_webp()) {
|
||||
document.getElementsByTagName('html')[0].classList.add('webp')
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
|
||||
Reference in New Issue
Block a user