Switch navbar dropdown from hover to click?

Created on 13 July 2023, over 1 year ago

I'm looking at how to extend default output to use more of the UIKit library - namely make a hover dropdown navbar become a click dropdown navbar. There are two ways to do this with UIKit - adding the attribute uk-navbar="mode: click" to <nav class="uk-navbar-container"> or triggering that with JS. But neither editing the page.html.twig file or adding the JS seemed to work.

I was about to give up but then testing another attribute, it worked. ie this:

  $(document).ready(function() {
    var clickdown = UIkit.navbar('#page--navbar', {
      dropbar: true
    });

turns the dropdown into a full-width dropbar. So some things work and I'm wondering if I'm missing something obvious when I write the same but with `mode: click` and the JS console gives "Uncaught Reference Error: click is not defined"? I thought it might be a UIKit 2 vs 3 thing but the same syntax was used v2 to define click dropdowns.

Many thanks in advance
Nic

ps - Many thanks to those who have kept sustaining this theme since the sad death of Richard Buchanan. I have been using this template for a few years, this week is the first time I've opened a Drupal account to comment.

💬 Support request
Status

Active

Version

3.16

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024