Home >Web Front-end >JS Tutorial >Rewrite a simple menu with flexible size_navigation menu
A small explanation here is that it is about the function of dynamically setting the font size. Since the form of the 3D menu is not considered, I simply used the cosine function
. In the specific implementation, in order not to have two characters appear in the total height of the menu The peak of the wave creates an abrupt feeling. In fact, the K in cos(x/K) should be a function related to the number of menu items and the maximum font value. Here I simply set it to a constant.
The complete code is