Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
Locked
0

How to add an 'Active' menu item in liquid Bootstrap menu

Contributor ,
Jul 02, 2016 Jul 02, 2016

Hi

I just added a new Liquid/ Bootstrap menu as per the article:

http://docs.businesscatalyst.com/user-manual/site-design/Menus/build-dynamic-menu-using-liquid#creat...

However I cannot find a solution to add the 'active' class to an active menu item.

see page:

Carousel Template for Bootstrap

Also, any idea why "<li style="list-style: none"> </li>" is added to rendered markup ?

Any ideas?

Thanks

TOPICS
How to
661
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 19, 2016 Jul 19, 2016
LATEST

I found this simple JS script that adds the 'active' state if anyone is interested. Just change the element ID and Tag name for what ever you use,

<script>

function setActive() {

  aObj = document.getElementById('navbar').getElementsByTagName('a');

  for(i=0;i<aObj.length;i++) {

    if(document.location.href.indexOf(aObj.href)>=0) {

      aObj.className='active';

    }

  }

}

window.onload = setActive;

</script>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines