Has anyone developed a way to automatically generate a left menu for a Weebly site, maybe through JavaScript or jQuery? I don't really care for the moving dropdown menus and would prefer to have side menus instead. On the Weebly forums site, there is a description about how to create each one manually, but then you would need to update it every time you added a page.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- jQuery add and remove delay
I have come up with my own solution for this, using jQuery and CSS.
Here's the general process:
Get the root link of the current page. If you're on a main link, then that's it, otherwise, climb the tree to the parent.
Determine if there are any sublinks to the main parent link. If not, do nothing with a left menu.
If there are sublinks, get those from the navigation that is already on the page.
Create a structure to move the page contents to the right and give room for the left menu.
Copy the sublinks into the left menu area.
The JavaScript
The CSS
For more detailed instructions on how to implement this, see my blog post: