Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:24

Highlighting static menus with dynamic pages (ajax based)


Poster: inhgswebmaster
Dated: Friday January 4 2008 - 15:33:56 GMT

I am trying to see how I can highlight the appropriate menu item using clickfunction and the mmpagehighlighter.js module for a website that the page content is driven by ajax - i.e. the lower portion of the page content changes when each menu item is clicked. So the page never refreshes (in html terms), which means the url stays the same. The problem I am seeing is that I can use the clickfunction to highlight the specific menu which has been clicked - which works - but since there is no page refresh - any previous clicked menu also stays highlighted! How can I turn off the previously highlighted menu item??
Thanks
Neil

Re: Highlighting static menus with dynamic pages (ajax based)


Poster: inhgswebmaster
Dated: Sunday January 6 2008 - 19:34:00 GMT

Ok - I've done more research into this have come up with the following....a modification on the highlightme() item...

Code:
lastClickedItem = -1;
lastOffbgcolor = -1;
lastOffcolor = -1;

function highlightme()
{
if (lastClickedItem > -1 && lastClickedItem != _itemRef) {
   _I=_mi[lastClickedItem];
   // Do we need to restore the last Offbgcolor & Offcolor
   if (_I[19] && lastOffbgcolor != -1 ) _I[7] = lastOffbgcolor;
   if (_I[18] && lastOffcolor != -1) _I[8] = lastOffcolor;
   itemOn(lastClickedItem);
   itemOff(lastClickedItem);
}
_I=_mi[_itemRef];
if(_I[19]) {
   // need to save the offbgcolor to restore back
   if (_itemRef != lastClickedItem) lastOffbgcolor = _I[7];
   _I[7]=_I[19];   
}
else {lastOffbgcolor = -1}
if(_I[18]) {
   // Save Offcolor as well
   if (_itemRef != lastClickedItem) lastOffcolor = _I[8];
   _I[8]=_I[18];
}
else {lastOffcolor = -1}

itemOff(_itemRef);
lastClickedItem = _itemRef;
}


This is then called by the clickfunction call in the menu item. Now my only problem I have with this approach it that clicking on second menu item in the same submenu seems to not actually action - it then brings up this page, when you click ANOTHER menu item in the same submenu! Clicking a menu item in another menu works as desired... so this is bizarre. Anyway, it's my 1st attempt at "customising" the menus and so there may well be a better way to do this.. so I am open to suggestions!!
Thanks
Neil

Re: Highlighting static menus with dynamic pages (ajax based)


Poster: Ruth
Dated: Sunday January 6 2008 - 20:17:23 GMT

Hi,

I'm not sure what you are saying. It brings up what page? Not that I can help on this since I don't know js and functions. There is a demos page which has some functions that were created in response to different posts in the forum.

Maybe one of those will give you some insight into what is needed, though the two that I think might help seem to no longer work, throwing an _mi[i][1] has no properties error. Since I have no idea what that is, I can't fix them, but thought maybe they would give you something in the way of direction??? The two I thought might interest you would be the Breadcrumb, which is to do the highlighting the menu when it is used to load pages into an iframe, the highlighting works except for the test item which won't load the page in the iframe now, and the other is the Pass Item Reference one. I'll post this to Milonic since I think you will need someone from there about the functions

http://support.milonic.com/demos/

Ruth

Re: Highlighting static menus with dynamic pages (ajax based)


Poster: inhgswebmaster
Dated: Sunday January 6 2008 - 21:42:54 GMT

Hi Ruth,
Maybe if you see it that will show what I mean... I have my new site which I am working on running here:
http://inhgs.hampshire.org.uk/inhgsnew/index.php
There is a top level horizontal menu showing ( eg Home/Feedback/Events etc..) Clicking on these work fine - i.e the menu item is changed to show that this is the page which is selected (and contents below change). Now if you mouseover Events, and click the 1st submenu item Obligations - this works, (page changes correctly and menu item highlighted and previous menu item reverts back to it's original state) now click the 2nd submenu item (Event Criteria) - this time the menu item change works but the page doesn't! Now if you click the 3rd submenu ((Event Summary) - again the menu item highlights as expected - but it brings up the Event Criteria page - ie. the page which was selected previously!! If you click any other menu item (i.e. not on the same submenu) then it all works ok - this bizarre behaviour only happens within the same submenu...
Does this make sense??
Regards
Neil

Re: Highlighting static menus with dynamic pages (ajax based)


Poster: inhgswebmaster
Dated: Monday January 14 2008 - 10:29:08 GMT

Hello - does anyone have any suggestions??? To me it looks like a bug in the milonic menu code...
Regards,
Neil

Re: Highlighting static menus with dynamic pages (ajax based)


Poster: Ruth
Dated: Monday January 14 2008 - 12:50:45 GMT

Hi,

I have posted this to Milonic but not heard anything yet, and this is way beyond anything I know.

You are getting other pages to load, but it's like it loads the last clicked but 1.

So, if are on main.php, and click obligations I get a page with Obligations To Avoid Delays In Play on it, though I still see main.php at the right under the menu. Now, if you then click on Entry Criteria, nothing happens, but if you then click any other button in that submenu, the page for that button doesn't load but the page for the last clicked item does load.

So, if I click obligations 1st I get that, then click Entry Criteria, nothing, but then click event summary, you get Entry Criteria, then click Statistics You get Event Summaries. So, it's like it waits for the clicked item to load the previous one, instead of the one clicked.

I suggest you contact Milonic from the main site with the issue. I will post again to them.

Ruth