| Page 1 of 1 | [ 4 posts ] |
|
YUI v 2.9
I have a Nav list with Drop Down tabs that have <a> tags nested in them. When one of the nested tags is clicked I want to change the css of an a tag that is higher up in the node list. Code: <ul id#nav> <li1> <a>nav1</a> <div>drop1 <a><img></a> <a>link1</a> </div> </li1> <li2> <a>nav2</a> <div>drop2 <a><img></a> <a>link2</a> </div> </li2> </ul> here is the code I have working to this point: Code: oTopNav.prototype.init = function() { YAHOO.util.Event.addListener(this.id,'click',this.changeSectionTrigger); } oTopNav.prototype.changeSectionTrigger = function(e) { var t = YAHOO.util.Event.getTarget(e); } This part is working. The Question: How can I id the top level a tag to change it's css when a lower level a tag is clicked? Would I use delegate? or can I use something like parentNode that works with an id instead of a specific .parent then .sibling order (since the node order is different for the lower level links)? |
|
I did work this out using a non YUI solution. I am still interested in knowing the YUI way to do this so any knowledge would be appreciated.
thanks |
|
Hi Preston,
I haven't done a lot of DOM operations with YUI 2.x but you could look into getAncestorByTagName which is in the DOM Utilities. I recommend you search the API there, lots of methods are available. This would be ALOT easier if you were using YUI 3 Todd |
|
Hello Todd,
Yes that is definitely what I needed to be working with. Thanks for your reply. In my research on this I was looking at the Node component in YUI3, appears to be a big improvement. Thanks again Preston |
| Page 1 of 1 | [ 4 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group