Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #608236

    Hi,

    I have 2 sliders on my development homepage and can hide the desktop slider so it doesn’t show on mobile sizes by using a class rule. The issue is it still calls for the slider and the images. Is there any way to use php to not call for both?

    #609294

    Hi Steven!

    Thank you for using Enfold.

    We haven’t fully tested this plugin but it should prevent the images from loading when the element or image is not visible in the page: https://wordpress.org/plugins/lazy-load/

    Combined with the following script, the images in the slider will not load:

    // remove slider
    add_action('wp_footer', 'ava_custom_script_slider');
    function ava_custom_script_slider(){
    ?>
    <script type="text/javascript">
    (function( $ ) {
        function a() {
            if( $( '#header' ).css( 'position' ) == 'relative' )
    		$( '.avia-slideshow' ).remove();
        }
    
        a();
    })(jQuery);
    </script>
    <?php
    }

    Replace “.avia-slideshow” with the custom selector for mobile.

    Best regards,
    Ismael

    #610288

    Hi Ismael, thank you for the response. Should I be replacing “.avia-slideshow” with the name of the desktop slider I’d like to hide?

    It doesn’t seem to remove the element – am I doing something wrong? http://christianmacleod.com/bluecmcampaign/

    Steven

    #610414

    Hi Steven!

    You need to replace .avia-slideshow with the custom class selector for your slideshow that you wish to hide.

    Cheers!
    Jordan

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.