Created
February 7, 2011 03:21
-
-
Save Yardboy/813957 to your computer and use it in GitHub Desktop.
site hover function review
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the function gets called inline via the onmouseover and onmouseout events like this | |
P7_MultiClass2('L3','show','nav_03','active_03')" | |
// essentially, the function is using the calling parameters to set set the classname for another item on the page | |
// since the classname they're adding is the "active_03", "active_04", etc., this is triggering the display of | |
// the submenu when you hover the nav item. | |
function P7_MultiClass2() { | |
var args=P7_MultiClass2.arguments; | |
// so, args = ['L3','show','nav_03','active_03'] | |
if(document.getElementById) { | |
for(var i=0; i<args.length; i+=2) { | |
// so, this steps through from 0 to 2, at 4 it's out of the loop | |
if(document.getElementById(args[i])!= null) { | |
// so, it checks for an element | |
// first, it looks for an element with id 'L3' (args[0]) | |
// second, it looks for an element with id 'nav_03' (args[2]) | |
if(document.p7setdown) { | |
// here I'm lost - not sure what p7setdown is - I can't find it | |
for(var k=0; k<p7dco.length-1; k+=2) { | |
// also not sure what p7dco is, can't find it either | |
if(args[i] == p7dco[k]) { | |
args[i+1] = p7dco[k+1]; | |
break; | |
} | |
} | |
} | |
document.getElementById(args[i]).className=args[i+1]; | |
} | |
} | |
} | |
} | |
// so, reading this code, and not finding the p7 variables/elements anywhere else in the site, I'm led to believe | |
// that this is a modular function that someone pulled in from somewhere else, but that they aren't using the | |
// functionality related to the p7 vars, which seems to be a method of overriding what comes in on the parms | |
// of the function call with some other default value, but it's not needed for the basic hover functionality | |
// it goes without saying that there is a much better/easier way to do this using jQuery. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment