Menu Item That Target An Anchor - Question | JoomShaper

Menu Item That Target An Anchor

Miguel

Miguel

Template 2 years ago

Hi there! Is there a way for a menu item that target an anchor to be marked as an active menu? Image I´m using the Konstra template with joomla 4.0.4. This is my web and the 3rd item of the menu target an anchor in the home page, so the menu item that is marked as active is the "Home" item instead of the "Processes" item (as you can see in the image above) . Is there a way to show the same 3er item as active?

0
5 Answers
Toufiq
Toufiq
Accepted Answer
Senior Staff 2 years ago #46389

Hi there,

Thanks for contacting us. Sorry for the inconvenience. Will you please provide me the Joomla administrator access to check the issue? I will check & get back to you soon. 

Note: Please share an screencast video about your issue

-Thanks

0
Paul Frankowski
Paul Frankowski
Accepted Answer
Senior Staff 2 years ago #46391

Hi,

I can be wrong but it request using extra code customization, only typical OnePage templates have this feature.

0
Pavel
Pavel
Accepted Answer
2 years ago #46449

Hi. In general, this work does bootstrap srollspy. But I could not apply it to Helix Menu. It works fine with the menu module, with HTML code, but not with Helix menu. It would be interesting to know why.

0
Miguel
Miguel
Accepted Answer
2 years ago #46831

Hi there. Here you can see the screen video, you can see how it is the "home" item marked as active when i choose the "processes" item, but when I choose an item that takes me to another page, it is that item the one marked as active. You can find the administrator access in the hidden content!

0
Pavel
Pavel
Accepted Answer
2 years ago #46893

Hi Miguel. I think this is outside the support of Joomshaper.

I got it working and here is the instruction:

Add two classes to the link in the menu item settings. Mandatory class nav-link and some kind of your own class for stylization, for example target-link.

Add following code to the custom.js file (read Helix documentation about this file)

For Helix Ultimate 1 based templates.

jQuery(function ($) {
    $('body').attr({
        'data-spy': 'scroll',
        'data-target': '.sp-megamenu-wrapper'
    });
     $('.sp-megamenu-parent').addClass('nav');
     $('.sp-menu-item').addClass('nav-item');
});

For Helix Ultimate 2 based templates.

jQuery(function ($) {
    $('body).attr({
        'data-bs-spy': 'scroll',
        'data-bs-target': '.sp-megamenu-wrapper'
    });
     $('.sp-megamenu-parent').addClass('nav');
     $('.sp-menu-item').addClass('nav-item');
});

Then use your own class to stylize active link state via css. For exemple:

.target-link.active {
    color: red !important;
}
1