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 |
|---|
| visible | Content is not clipped and may be rendered outside the content box. |
| hidden | Content is clipped - no scrolling mechanism is provided. |
| scroll | Content is clipped - a scrolling mechanism is provided. |
| auto | If the content overflows the box, a scrolling mechanism should be provided. |
| no-display | If the content does not fit the content box, the entire box is removed. |
| no-content | If the content does not fit the content box, the entire content is hidden. |
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.