Navigation Bar

0
Hello, I have got the following problem: I have got five pages in my app. When I go back to my homepage from a page via the navigation bar the “house” gets blue. When I now  go to another Page via a Button in inside the homepage, the “house” remains blue. So in the navigation bar, it looks like a user is on the home page but actually can be on another page. When I switch to another page via the navigation bar everything works fine and the blue colour dissapears.  Does anyone know how to solve this problem?
asked
4 answers
1

This is because color changes in navigations are depending on the click of navigation items. So when inside home page, you click a button and go to another page you are not clicking any item in the navigation bar so the active class on the home item of nav bar does not change. 

I had experienced a similar scenario, and to make color changes of navigation items I had to implement a custom solution like this which removes active class from home and add active class to the visited page
 

$('.mx-name-actionButton1').on('click', function(e) {
    $('.navbar-inner li:first a')[0].classList.remove('activeLink');
    $( ".navbar-inner li a:contains('SecondPage')" )[0].classList.add('activeLink');

});

 

answered
0

Hey Umar,

Thank you for your help!

I think I unterstand what you are doing, but I do no fully unterstand every step.

Can you explain me a little more in detail what you are doing there? 

 

Or maybe with a little example: 

Lets say I have got two pages: 1.”Home”   2.”Page2 “  

I now what to use a action button to go from Home to Page2? 

How does the class has to look like?

 

 

answered
0

I made a widget for this a while back. It may or may not still work in Mendix 8. If it doesn’t, it’s almost certainly a quick fix:

https://github.com/tieniber/ActiveMenuSelector

 

 

answered
0

Can anyone help me with the problem I explained above? How can I implement a dynamic class which changes the navigation bar?

best regards :) 

answered