Home Experience & Tips Sharing Standard Post

Standard Post

Adding Scroll Functionality to WordPress Dropdown Menus

Today, I set up a scrolling function for a client's foreign trade website menu, making a record. Some foreign trade websites using WordPress for e-commerce, many themes support mega menus, which may cause a submenu to be very long, not conducive to display. So we need to set a function to show a scrollbar when exceeding a certain pixel height. The method is simple, add an overflow...

Posted on June 24, 2020 About 2 minutes read
给WordPress下拉菜单添加滚动功能

Today, I set up a scroll function for a client's foreign trade website menu, making a record here.

For many foreign trade e-commerce websites built with WordPress, many themes support mega menus. This can lead to very long content in certain submenus, which is not ideal for display. Therefore, we need to set it up so that 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 example, set the maximum height to 500px, and then overflow-y becomes scroll.

The overflow-y property specifies whether to clip the top/bottom edge content if it overflows the element's content area.

Supports the following values:

Description
visibleContent is not clipped and may be rendered outside the content box.
hiddenClip content – no scroll mechanism provided.
scrollCropped Content – Provides a scrolling mechanism.
autoA scrolling mechanism should be provided if the content overflows the box.
no-displayIf the content does not fit the content box, the entire box is removed.
no-contentHide the entire content if it does not fit within the content box.
4.4/5 - (5 votes)
Previous NameSilo Domain Transfer Push Tutorial Continue reading content around the same timeline. Next How to check SiteGround server IP and DNS and resolve a domain View the next related tutorial or experience.

AI Website Building Assistant

🤖
Hello! I am the Naibabiji AI Assistant. How can I help you?
Quick Consultation: