My code is working in all browsers except IE 7.
IE 7 continually throws an error that "position().top is null or not an object".
My function receives a selector string and uses it to attempt to get the position of an element as shown below. The weirdest part is, I can run this function from the console and it works properly! It's like IE errors out initially when reading that dynamic object in the function. HELP this is driving me insane.
function getMyPosition(objectName){
var returnPos = $(objectName).position().top;
return returnPos;
}
$('li a',navContainer).each(function(){
var myId = $(this).attr("href"),
myBlock = $(myId),
blockPos = _getMyPosition(myId);
myObj = {"navItem":$(this),"nom":myId,"block":myBlock,"pos":blockPos};
subNavItems.push(myObj);
});