EDIT: Never mind. Figured out the issue. Just made height an array and name each id. Der. thanks anyway.
I've searched and not turned up much on this. I've got a simple script that just animates a drop down menu sliding out when hovered over. The issue is if I quickly move back and forth between two or more of the menu items the height variable I set at the begin of each hover can be overwritten. I've got a work around that fixes it after moving off and then back on again by resetting the height to auto when it's off screen but I wont to prevent it from happening at all. Usually I would make a dynamic avariable in other languages I've worked in like:
$height = $(this).attr("id")+"height";
alert($$height);
//which would theoretically alert the height of whatever triggered it.
Is there a way to do this in jQuery so each element that calls the function has it's own height variable?
EDIT2: Since there is interest I'll paste the whole thing.
$("#NavMenu > li").hover(
function () {
var height = {};
height[$(this).attr("id")] = $(this).find("ul").css("height");
$(this).find("ul").css("height", "0px");
$(this).find("ul").css("left", "auto");
$(this).find("ul").animate({ height: height[$(this).attr("id")] }, 300)
},
function () {
$(this).find("ul").css("left", "-999em");
$(this).find("ul").css(height, height[$(this).attr("id")])
}
)
$(this).attr('id'), you can dothis.id.