[Resolved] Need Advice – image/banner slider

Home Forums Support [Resolved] Need Advice – image/banner slider

Home Forums Support Need Advice – image/banner slider

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

    Hello,

    I have to show static banners in slider with links.
    I tried many sliders but have some issues.

    Banner and links work great in desktop, but when it is mobile slider use same size image and it cause low score on page speed insights. “Use correct size of images”

    I can make 2 banners, 1 for desktop and 1 for mobile.
    But I want to make sure only 1 of them really loaded each time. (not css hide)

    or image can be resized by using same ratio for mobile.

    I really did search a lot and tried many slider plugins.

    Do you have any advice for this?

    #1657196
    Leo
    Staff
    Customer Support

    Hi there,

    Unfortunately I don’t believe there is a solution for this.

    You could try looking into this function but I’m not sure if it would work for sliders:
    https://developer.wordpress.org/reference/functions/wp_is_mobile/

    For this type of general WordPress question, it might be worth asking on a general WordPress forum like this:
    https://wordpress.stackexchange.com/

    #1661593
    roadlink

    I tried this one and seems OK for now.

    This one to hook

    <div class="sliderdiv">
    <?php
    if ( wp_is_mobile() ) {
    echo do_shortcode('[metaslider id="390637"]');
    } else {
    echo do_shortcode('[metaslider id="2703"]');
    }
    ?>
    </div>

    This one to additional css

    /* Slider div settings */
    .sliderdiv {
    	padding: 5px 0px 5px 0px;
    }
    
    #1662117
    Leo
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.