Dynamic Categories widget – static grid layout on mobile not working

3 replies2 participantsUpdated by Jack Richardson

  • Avatar: Andrei Andrei
    Andrei Andrei
    Participant

    Hello,
    I am using the Dynamic Categories widget on mobile and I need it to display as a static grid (4 columns, all categories visible, no carousel/swipe) similar to how it looks in the attached Screenshot 1.
    I managed to achieve this layout using custom CSS that disables the Swiper and wraps the slides into a grid. However the CSS breaks the swipe functionality on other widgets on the same page.
    The CSS I used:
    cssselector .etheme-dynamic-categories-wrapper .swiper-wrapper {
    flex-wrap: wrap;
    transform: none !important;
    width: calc(100% + 10px);
    pointer-events: none;
    margin: 0 -5px;
    overflow: visible !important;
    }

    selector .etheme-dynamic-categories-wrapper .swiper-slide {
    width: 100% !important;
    flex: 0 0 25%;
    max-width: 25%;
    pointer-events: all;
    padding: 5px;
    margin: 0 !important;
    }
    Without this CSS the widget displays as a carousel with oversized slides and only 2-3 visible at a time (Screenshot 2).
    My questions:

    Is there a built-in option to display the categories as a static grid on mobile instead of a carousel?
    If not, what is the correct way to override the Swiper behaviour only for this widget without affecting other carousels on the same page?

    Thank you.

    Files is visible for topic creator and
    support staff only.

    3 Answers

    Avatar: Jack Richardson
    Jack Richardson
    Support staff

    Hello @Andrei Andrei,

    Please try adding the following custom CSS to your Spotlight Categories widget under “Advanced → Custom CSS”:

    @media only screen and (max-width: 768px) {
        selector .etheme-dynamic-categories-wrapper .swiper, .etheme-dynamic-categories-wrapper .swiper-wrapper {
            cursor: default !important;
            overflow: visible !important;
            pointer-events: none;
        }
        selector .etheme-dynamic-categories-wrapper .swiper-wrapper {
            flex-wrap: wrap;
            transform: none !important;
            width: calc(100% + 10px);
            pointer-events: none;
            margin: 0 -5px;
            overflow: visible !important;
            display: flex;
        }
        
        selector .etheme-dynamic-categories-wrapper .swiper-slide {
            width: calc(100% / var(--cols, 4)) !important;
            pointer-events: none;
            padding: 5px;
            margin: 0 !important;
        }
        selector .etheme-category-grid-image.rounded {
            aspect-ratio: 1/1;
            width: auto;
            height: auto;
        }
        selector .etheme-dynamic-categories-wrapper .etheme-category-grid-image.rounded img, 
        selector .etheme-dynamic-categories-wrapper .etheme-category-grid-image:not(.etheme-category-grid-image-ghost).rounded img {
            object-fit: cover;
            width: auto;
            height: auto;
        }
    }
    @media only screen and (max-width: 550px) {
        selector .etheme-dynamic-categories-wrapper {
            --cols: 3;
        }
    }

    If you require our assistance, please provide the correct wp-admin access in the private content section.

    Please note that there are currently no settings available to create a grid layout on mobile devices, as we have not yet received such requests on our task board. You are welcome to submit this as a feature request (https://www.8theme.com/roadmap/), and we will review its popularity based on customer votes.

    Best regards,
    Jack Richardson
    The 8Theme’s Team

    Avatar: Andrei Andrei
    Andrei Andrei
    Participant

    sorry but it seems your css is not working, i would like to have lik ein screenshot 2 only on mobile

    Files is visible for topic creator and
    support staff only.
    Avatar: Jack Richardson
    Jack Richardson
    Support staff

    Hello,

    We have observed that the slider is currently displayed on desktop devices, while a grid layout for these categories appears on devices with a width below 768px, as defined in our CSS. You may adjust this breakpoint to suit your responsive design needs, for example, to 480px.

    We have tested the configuration, and it functions correctly on our end. However, if you encounter any issues, please provide detailed clarification. You can also modify the “–cols” (currently set to value 4) value in your CSS to adjust the number of columns as needed.

    Our tests:
    Desktop: https://gyazo.com/72e79f3fc3e3f08abe19b1f0edddedff
    Responsive (below 768px): https://gyazo.com/e0180e153fa2bac648afd2b1d9b0f950

    If you require our assistance, please provide the correct wp-admin access in the private content section.

    Best regards,
    Jack Richardson
    The 8Theme’s Team

Want to reply? Log in, or register with your ThemeForest purchase code, to reply to this topic.

Login / Register