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

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.

(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

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


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
//if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
var topedge=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
return edgeoffset

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

Thank you SO much :)