PDA

View Full Version : AnyLink CSS Menu - Right Menu shifts left



idesign123
04-25-2007, 08:43 AM
1) Script Title: AnyLink CSS Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/anylinkcss.htm

3) Describe problem:
The menu works fine when you have the browser window open wide, but when you narrow your browser window, the dropdown on the far right shifts to the left.

Example:
(URL removed - temporary demo)
'Preschool', 'Kids' & 'Teens' are aligned correctly
'Adults' is shifted to the left (when the browser window is not much bigger than the content).

My 'problem' would be considered a 'feature' in other situations. If the rightmost menu is beyond the right edge of the browser, you WANT it to shift to the left. But my dropdown menu shifts to the left even if there is plenty of room for the menu.

I suspect the issue is that the right menu has the following style...
margin-left: -123px;
For cosmetic reasons, the menu was shifted 123pixels to the left, but the browser still 'thinks' that the right menu extends way to the right of the page content (and thus shifts the menu to the left).

Does that make sense?

I hope so, since I'm baffled as to how to solve this.

Thank you very much for any help you can give me :o

idesign123
04-29-2007, 12:18 PM
Anyone?
I can put together a simplified demo if that would help.

:Stacey

jscheuer1
04-29-2007, 02:28 PM
In the script, find this section and add the red parts:


function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
//var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
//dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
//if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=0//dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

idesign123
04-29-2007, 06:24 PM
That fixed it!!!

Thank you SO much :)