|
rubyaim -> RE: Accessible Suckerfish Drop-Down Menu Problems (2/11/2007 16:19:04)
|
Looking good [:)] For the spacing / gaps, just keep mucking around with the css, I think that is what took me the longest to get sorted out. I'm not sure about the arrow, I have similar and ended up using another div but I'm not convinced this is the best way to do it. Eg: I'm wrapping a link in a div like: <div class="arrow"> <a href="../example/something.htm">Something</a> </div> And .arrow is styled like: .arrow { background:url('arrow.gif'); background-repeat:no-repeat; background-position:right; width:98%; } I keep meaning to go back and look at this, but have not got around to it. For the tabbing, I think you will need more Javascript, try replacing your menu js with: <!--//--><![CDATA[//><!--
sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls.onmouseover=function() {
this.className+=(this.className.length>0? " ": "") + "sfhover";
}
sfEls.onmouseout=function() {
this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
}
}
}
mcAccessible = function() {
var mcEls = document.getElementById("nav").getElementsByTagName("A");
for (var i=0; i<mcEls.length; i++) {
mcEls.onfocus=function() {
this.className+=(this.className.length>0? " ": "") + "sffocus"; //a:focus
this.parentNode.className+=(this.parentNode.className.length>0? " ": "") + "sfhover"; //li < a:focus
if(this.parentNode.parentNode.parentNode.nodeName == "LI") {
this.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sfhover"; //li < ul < li < a:focus
if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "LI") {
this.parentNode.parentNode.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sfhover"; //li < ul < li < ul < li < a:focus
}
}
}
mcEls.onblur=function() {
this.className=this.className.replace(new RegExp("( ?|^)sffocus\\b"), "");
this.parentNode.className=this.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
if(this.parentNode.parentNode.parentNode.nodeName == "LI") {
this.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "LI") {
this.parentNode.parentNode.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
}
}
}
}
}
// only ie needs the sfHover script. all need the accessibility script...
// thanks http://www.brothercake.com/site/resources/scripts/onload/
if(window.addEventListener) window.addEventListener('load', mcAccessible, false); // gecko, safari, konqueror and standard
else if(document.addEventListener) document.addEventListener('load', mcAccessible, false); // opera 7
else if(window.attachEvent) { // win/ie
window.attachEvent('onload', sfHover);
window.attachEvent('onload', mcAccessible);
} else { // mac/ie5
if(typeof window.onload == 'function') {
var existing = onload;
window.onload = function() {
existing();
sfHover();
mcAccessible();
}
} else {
window.onload = function() {
sfHover();
mcAccessible();
}
}
}
//--><!]]> Edit: The js didn't paste, but try copying it from the original page for this menu at: http://carroll.org.uk/sandbox/suckerfish/bones2.html
|
|
|
|