Make Your Divi Ajax Filter Sticky on Mobile Devices

Easy

CSS

Machine, BodyCommerce, Ajax Filter

Details

This Divi code snippet enhances the user experience on mobile devices by making the Divi Ajax Filter sticky at the top of the screen, ensuring it remains accessible as users scroll through product or archive lists. Ideal for sites using Divi Machine, Divi Ajax Filter, or Divi BodyCommerce, this CSS tweak requires adding a class (sticky-mobile-filter-container-row) to the row containing the filter.

Implementing this Divi code snippet can significantly improve navigation and usability on e-commerce sites, making it easier for customers to apply filters without needing to scroll back to the top.

Snippets Demo

Code

1

Description:
Add the class sticky-mobile-filter-container-row in the row containing the filter.

Language: CSS

Where to add: Divi Theme Options

                        /* This CSS snippet is designed for Divi Engine plugins like Divi Machine, Divi Ajax Filter, and Divi BodyCommerce. 
   It enables a sticky filter feature on mobile devices for a row with the class name 'sticky-mobile-filter-container-row'. 
   Specifically, it makes the first column of a two-column row (typically containing the filter module) sticky at the top of the viewport on mobile screens. */

@media (max-width: 980px) { /* Targets screens with a maximum width of 980px, typically tablets and mobile devices. */
    .sticky-mobile-filter-container-row > .et_pb_column:first-child {
        position: -webkit-sticky; /* Ensures compatibility with Safari mobile browsers. */
        position: sticky; /* The sticky positioning keeps the element at the top of the viewport as the user scrolls. */
        top: 0; /* This value can be adjusted to change the offset from the top of the viewport. */
        max-height: calc(100vh - 0px); /* change 0px to whatever value you have put in for "top:. Ensures content in the column is not out of the viewport */
        overflow-y: auto;
    }
}
                    

Related Snippets

Explore more from Divi Engine

Divi Form Builder

Divi Form Builder

From simple contact forms to complex frontend post or product creation, Divi Form Builder has you covered.

Divi Form Builder
Find out more
Divi Machine

Divi Machine

Build complex websites that displays dynamic fields you can filter, search and so much more with the Divi Builder.      

Divi Machine
Find out more
Divi BodyCommerce

Divi BodyCommerce

A versatile toolkit for developers using Divi and WooCommerce together, designed to boost your e-commerce site and achieve greater conversion rates.    

Divi BodyCommerce
Find out more
Divi Handoff

Divi Handoff

Let clients update content without touching the Divi Builder. Design layouts once, connect them to Flexible Content fields, and give editors simple forms for text, images, and sections.

Divi Handoff
Find out more
Divi Loop Extender

Divi Loop Extender

Unlock the Full Power of Divi 5 Loop Builder Add advanced sorting, filtering, and relationship logic right inside the Visual Builder.

Divi Loop Extender
Find out more
Divi Membership

Divi Membership

Monetize your Divi websites by transforming them into membership sites with seamless subscription management, user-friendly interfaces, and customizable membership tiers.

Divi Membership
Find out more
Divi Machine Accounts

Divi Machine Accounts

Build an account area for your customers to edit their details, access wishlist, submitted posts and more. *Note: Requires Divi Machine installed and active

Divi Machine Accounts
Find out more
Divi Ajax Filter

Divi Ajax Filter

Filter WooCommerce, Posts & Custom Posts without reloading the page.    

Divi Ajax Filter
Find out more
Divi Mobile

Divi Mobile

Divi Mobile helps you create beautiful looking mobile menus without having to code.

Divi Mobile
Find out more
Divi Nitro

Divi Nitro

Give your Divi website that extra boost of speed with our Divi Nitro plugin to enhance your customer's experience.

Divi Nitro
Find out more
Divi Protect

Divi Protect

Password protect the content of your Divi website with our Divi Protect plugin. Keep unwanted eyes out!

Divi Protect
Find out more
Divi Mega Menu

Divi Mega Menu

Create stunning, responsive, and content-rich mega menus using the Divi Builder you already know. No coding required.  

Divi Mega Menu
Find out more