I'm new to Object-Orientated-Programming. I am trying to pass a element class as a parameter to a function. I know I've missed something...see code below:
var n = new Object();
n.mousePosition = function(class, y){
$(document).mousemove(function(e){
if(e.pageY < y){ $(class).slideDown(200); }
if(e.pageY > y){ $(class).slideUp(200); }
});
}
n.mousePosition('.nav', 100);
The .nav is the element class name which I'm trying to pass to my function as the class parameter, the $(class).slideDown... is not picking it up
Any help would be greatly appreciated, thanks
classis a reserved word in JavaScript, what happens if you use a different variable name (elemClass, for example)?