bcamp1973
2008-Apr-01 19:01 UTC
prototype.js $(''element'').getHeight() returning incorrect values
i''m trying to use the following function to "expand" the element that''s clicked on (in an unordered list) and "collapse" it''s sibling elements. this function is then called within another that shows/hides the contents of the elements. In this case "sOpenObject" would be the <li> you clicked on, "aClosedObjects" would be an array of it''s sibling <li>s (not including itself) and "sParentObject" would be the parent <ul>. However, the getHeight() method is returning height values way off the mark. Any ideas whay? function setSize(sOpenObject, aClosedObjects, sParentObject) { var totalHeight = sParentObject.getHeight(); var closedObjHeight = 0; for(var i=aClosedObjects.length-1; i>=0; i--) { if($(aClosedObjects[i])) { $(aClosedObjects[i]).style.height=''auto''; closedObjHeight = closedObjHeight + $ (aClosedObjects[i]).getHeight(); } } sOpenObject.style.height = (totalHeight - closedObjHeight) + ''px''; } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---