1) Script Title: Chromemenu within absolute or relative positioned div's
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...rome/index.htm
3) Describe problem:
When putting a chromemenu within an absolute ore relative positioned DIV, the prsition calculation did not work properly so that the menu is popped up on a wrong position.
I have made a chang in the positionning function so that the calculation stops when the offset element is absolutely or relatively positioned:
This works fine now.Code:measure: function(el, styleProp) { var st; if (el.currentStyle) st = el.currentStyle[styleProp]; else if (window.getComputedStyle) st = document.defaultView.getComputedStyle(el, null).getPropertyValue(styleProp); return st; }, getposOffset:function(what, offsettype){ var pos; var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop; var parentEl=what.offsetParent; while (parentEl!=null){ pos=this.measure(parentEl, 'position'); if (pos=='absolute' || pos=='relative') { break; } totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop; parentEl=parentEl.offsetParent; } return totaloffset; },
Thomas





Reply With Quote
Bookmarks