jquery - Prevent CSS document from loading on mobile devices -
trying increase loading speed mobile devices, , there @ least 1 css document don't want loaded on mobile.
i have prevented script loading, css document kinda different.
here example of don't want loaded on mobile devices:
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/css/animations.css">
do have working solution?
not sure tags correct, done css in beginning of document, or jquery or html.
since have javascript-based mobile detection (you should have noted in op important), can use javascript load css. simple as:
<script> if(!ismobile.any()) { document.write('<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/css/animations.css">'); } </script>
this simple approach. might better use dom manipulation insert link. check out answer more thoughts on how can - how load css files using javascript?
Comments
Post a Comment