ForumSpark Support app Faster, straight from your home screen. Tap Share, then Add to Home Screen.
Add ForumSpark Support to your home screen
  1. Tap Share at the bottom of Safari.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add. ForumSpark Support now opens like an app.
  1. Tap Install, or open the browser menu.
  2. Choose Install app or Add to Home screen.
  3. Confirm. ForumSpark Support now opens like an app.

Navigation Link Drop-Down Menus

Cory's Avatar
Cory · in Themes & Extensions
2 replies 227 views

Preview

All you need to edit is the following area:

const subLinks = {
    Members: [`<a href="">Test</a>`, `<a href="">Test 2</a>`],
    Search: [`<a href="https://www.google.com/">Google</a>`, `<a href="https://www.yahoo.com/">Yahoo</a>`]
};

Members and Search represent the name of the navigation link you want to append a drop-down menu to, and the HTML can be edited to include the links you want to add to the drop-down menu. Repeat a line and edit to add a drop-down menu. Include a comma after every array except for the last one.

Admin CP โ†’ Themes โ†’ Board Templates โ†’ Head

<style>
a.nav-link:hover {
    display: inline;
}

a.nav-link:hover ul {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    margin-top: .75rem;
    margin-left: -1.30rem !important;
}

a.nav-link li.panel {
    margin: 0 !important;
    border-width: 1px;
}

a.nav-link li.panel:not(:last-child) {
    border-bottom-width: 0;
}

a.nav-link a {
    font-weight: 400;
    display: block;
    padding: .75rem 1.25rem;
}
</style>

Admin CP โ†’ Themes โ†’ Board Templates โ†’ Below the board

<script>
const subLinks = {
    Members: [`<a href="">Test</a>`, `<a href="">Test 2</a>`],
    Search: [`<a href="https://www.google.com/">Google</a>`, `<a href="https://www.yahoo.com/">Yahoo</a>`]
};
const navLinks = document.querySelectorAll('a.nav-link');

if (navLinks) {
    const keys = Object.keys(subLinks);

navLinks.forEach(element => {
    for (const i of keys) {
        if (element.innerText === i) {
            const ul = document.createElement('ul');
            ul.style.display = 'none';
            element.appendChild(ul);

            for (const key of subLinks[i]) {
                const li = document.createElement('li');
                li.className = 'panel';
                li.innerHTML = key;
                element.querySelector('ul').appendChild(li);
            }
        }
    }
});
}
</script>

This is very cool. How would I add an arrow to a dropdown?

Gizmo said:

This is very cool. How would I add an arrow to a dropdown?

Try something like this:

a.nav-link[href$="search"]::after {
    content: 'โ†“';
    padding-left: 5px;
}

search is the string at the end of the URL.

You might also like...

Topic Replies Views Last reply
Guide on creating a drop down menu with multiple links Related, started by nyambegeramakori, 5 months ago
1 589
Cedric's Avatar
Cedric5 months ago
New Navigation Bug with Dropdown menu Related, started by Eclipse, 6 months ago
4 487
Cedric's Avatar
Cedric6 months ago
Dock, Paper and links that play From the blog, started by Cedric, 3 months ago
26
Cedric's Avatar
Cedric3 months ago
Link Directory Menu Customization Defaults to Homepage Related, started by Eclipse, 6 months ago
1 589
Cedric's Avatar
Cedric6 months ago
Link Directory In Themes & Extensions, started by Cedric, 7 months ago
4 220
Cedric's Avatar
Cedric6 months ago