We have created an image heavy site and are finding our page speeds for mobile aren’t what they should be. Would you happen to be able to recommend a way to disable the slider (both Easy Slider and Layer Slider) for mobile devices that doesn’t resort to a display:none usage? It’s my understanding that the slider will still load even if it’s not displaying.
Thanks so much for your help!
Hi wildflowermeadows!
Thank yo for using Enfold.
You can use the .remove jquery function. Add something like this on functions.php:
/**
* Remove element on mobile device
*/
add_filter('wp_footer', 'avf_remove_element', 10);
function avf_remove_element() { ?>
<script>
(function($){
if ($(window).width() <= 768){
$('ELEMENTS TO BE REMOVED HERE').remove();
}
})(jQuery);
</script>
<?php
}
Best regards,
Ismael
Thank you so much for the quick reply and for the detailed help. We will give it a try.
Please let us know how it goes so we can mark the topic as solved :)
Cheers!
Josue
Yes, this worked like a charm. Thanks for your help!