🚀 Is building a website too difficult? Let me guide you step by step—Learn about the 「Naibabiji WordPress Website Building Coaching Service」 →

Add scrolling functionality to WordPress dropdown menus

Today, I set up a scroll function for a client's foreign trade website menu, making a record here.For some foreign trade websites using WordPress for e-commerce, many themes support mega menus, which can result in very long content for certain submenus, making it difficult to display. Therefore, we need to set up a function where a scrollbar appears after exceeding a certain number of pixels. The method is simple: just add an overflow-y parameter.
ul ul{
    max-height:500px;
    overflow-y:scroll;
}
For example, in the above case, the maximum height is set to 500px, and then overflow-y is changed to scroll. The overflow-y property specifies whether to clip the top/bottom edge content if it overflows the element's content area. It supports the following values:
Description
visibleContent is not clipped and may be rendered outside the content box.
hiddenContent is clipped - no scrolling mechanism is provided.
scrollContent is clipped - a scrolling mechanism is provided.
autoIf the content overflows the box, a scrolling mechanism should be provided.
no-displayIf the content does not fit the content box, the entire box is removed.
no-contentIf the content does not fit the content box, the entire content is hidden.

🚀 Still feeling confused after reading the tutorial? Let me guide you step-by-step instead.

「Naibabiji WordPress Website Building Coaching」 — From selecting a domain and purchasing hosting to installing themes and publishing posts, I「ll guide you through every step, helping you avoid detours and reach your goals directly.

👉 Learn about Website Building Coaching Service
🔒

Comments are closed

The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.

×
二维码

Scan to Follow