Hi erwin, I will certainlly do the way you say. observe the click event, that will call the function, and unselect all elements selected to then select the one user choose.
And I'm sure if you post a bit of code, there will be a lot a fellow to criticise positivelly :)) !! -- david On 20 fév, 12:41, Erwin <[email protected]> wrote: > I am trying to have a drop-down menu using Prototype ... right nw it > runs well but I don't have yet the 'selected' class implemented ... > I believe I need to add a new Event.observe for the click, to fire a > function clickDetected , in which I'll have to unselect all menu > items but the one clicked... but what could be the best wriring using > Prototype lib ? > > my prototype_menu.js is the following : > > var Menu = Class.create(); > Menu.prototype = { > initialize: function(idOrElement, name, customConfigFunction) {...}, > config: function() {..} > > } > > var MenuContainer = Class.create(); > MenuContainer.prototype = { > initialize: function(idOrElement, parent) {...}, > init: function(idOrElement, parent) {...}, > getBorders: function(element) {...}, > open: function() {....}, > close: function() {...}, > closeAll: function(trigger) {...} > > }; > > var MenuItem = Class.create(); > Object.extend(Object.extend(MenuItem.prototype, > MenuContainer.prototype), { > initialize: function(idOrElement, parent) {...}, > openItem: function() {...}, > closeItem: function(trigger) {...} > > }); > > var menu; > function configMenu() {...} > function initMenu() { menu = new Menu('root', 'menu', configMenu); } > > Event.observe(window, 'load', initMenu); > > the html code is like that : > <div id="menu"> > <ul class="level1" id="root"> > <li><a href="#">Top One</a> </li> > <li><a href="#">Top Two</a></li> > <li><a href="#">Top Three</a></li> > <li> > <a href="#">Top Four</a> > <ul class="level2"> > <li><a href="#">Sub A</a></li> > <li> <a href="#">Sub B</a></li> > <li><a href="#">Sub C</a></li> > <li><a href="#">Sub D</a></li> > </ul> > </li> > <li><a href="#">Top Five</a></li> > </ul> > </div> > > thanks for your advices, links .. suggestions... > > erwin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
