Lynne - thank you for this and I have played around with it and with some small changes to suit my needs it works well.
But I would like to add that I am having an issue with this whole new navbar setup for v4 especially given that the navbar is the most changed component, in my opinion, in vb.
I use a navbar that is very similar to the new v4 one except with the added functionality of being able to hover on a tab and access the submenu of that tab for a set millisecond time before it bounces back to the currently selected tab.
To do this I have to set the criteria for its use when using v3.8.5:
Code:
<script type="text/javascript">
<if condition="in_array(THIS_SCRIPT, array('adv_index', 'about', 'sendmessage','support','staff','memberlist','online', 'private', 'register'))">tabmenu.definemenu("menu", 0)</if>
<if condition="in_array(ADV_DYNA_PREFIX, array('aircraft', 'acnotice'))">tabmenu.definemenu("menu", 1)</if>
<if condition="in_array(THIS_SCRIPT, array('aircraft_register', 'aircraft_types'))">tabmenu.definemenu("menu", 1)</if>
<if condition="in_array(THIS_SCRIPT, array('blog', 'blog_usercp'))">tabmenu.definemenu("menu", 2)</if>
<if condition="in_array(ADV_DYNA_PREFIX, array('clubs', 'download', 'terms'))">tabmenu.definemenu("menu", 3)</if>
<if condition="in_array(THIS_SCRIPT, array('calendar', 'view', 'vbgooglemaphse', 'links_index', 'quiz', 'weather', 'weather_arfor', 'weather_metar', 'weather_taf', 'weather_sigmet', 'flight_planner'))">tabmenu.definemenu("menu", 3)</if>
<if condition="in_array(THIS_SCRIPT, array('index', 'album', 'group', 'search', 'showthread', 'forumdisplay', 'newthread'))">tabmenu.definemenu("menu", 4)</if>
<if condition="in_array(ADV_DYNA_PREFIX, array('quotes'))">tabmenu.definemenu("menu", 5)</if>
<if condition="in_array(THIS_SCRIPT, array('arcade', 'gallery_index', 'gallery_upload', 'gallery_search', 'gallery_slideshow', 'gallery_albums', 'gallery_edit', 'gallery_delete', 'vbtubepro', 'youtube_browser'))">tabmenu.definemenu("menu", 5)</if>
<if condition="in_array(THIS_SCRIPT, array('profile', 'member', 'subscription'))">tabmenu.definemenu("menu", 6)</if>
<if condition="ADV_DYNA_PREFIX == 'classifi'">tabmenu.definemenu("menu", 8)</if>
<if condition="$pg=='advertising_rates'">tabmenu.definemenu("menu", 0)</if>
</script>
Following this criteria are all the different sub menus which are listed as ul and li's.
As you can see it is a "dogs breakfast" of an array and trying to convert this to a more vb way using your great tutorial here is really, for me, going from one "dog's breakfast" to another.
So I raise this question...there must be a better way for everyone to manage their v4 navbar?
Could a global variable be created and:
- each time a user clicks a tab or submenu item the global variable is set to a number to correspond to the tab id
- the page changes to the linked page
- the tab that corresponds to the global variable is then made "selected"
Very little code would be needed to facilitate this, you wouldn't need to worry about "THIS SCRIPT" or any other definition of what page is being displayed, very simple to include a setting of the global variable on clicking, and then reading the variable on page display etc.
Is this an option? Would it make the navbar easier to manage? Would it improve performance?