تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
2277 أدوات العرض

Hi all,


Is it possible to make the parent item of a dropdown menu in the main navigation link to a specific page?


The display for the dropdown menu is set to: hover, so it won't interfere with the user if they want to select an item in said dropdown menu.


Example:

- Services -> link to /services can you make this a link? If yes, how?

-- Hardware and infrastructur --> links to a page (already works)

-- Hosting and ASP --> links to a page (already works)

الصورة الرمزية
إهمال
أفضل إجابة

Hey, this is the workaround that I use

  1. Go to website editor and enter the edit mode
  2. Click theme tab and scroll down
  3. Under the Website Settings, click on "</body>" button beside the code injection field
  4. Add the following code

<script>
var links = document.querySelectorAll('a.nav-link.dropdown-toggle[href="#"] > span');
var MenuA = Array.from(links).find(span => span.textContent.trim() === 'Menu A');
if (MenuA) {

​var link = MenuA.parentElement;

​link.addEventListener('click', function(e) {

​e.preventDefault();

​window.location.href = '/menu-a';

​});

}

</script>

It is kind of hardcoded, but if you want another alternative, please refer to this link: https://www.odoo.com/en_US/forum/help-1/website-navbar-menu-links-with-sub-menu-200257

الصورة الرمزية
إهمال
أفضل إجابة

That's a good question. 

I cannot believe this functionality is not included by default or nobody has posted a solution for such a simple question :(




الصورة الرمزية
إهمال

Hey Teodor, please refer to my answer

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أغسطس 24
1206
2
يناير 23
3083
1
يونيو 15
2661
0
مارس 15
3503
2
مايو 24
8892