PDA

View Full Version : AnyLink CSS Menu - pushes up in small browser windows



hanji
01-09-2009, 04:09 PM
1) Script Title: AnyLink CSS Menu (horizontal)

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

3) Describe problem: I'm having a problem if the browser window is small and the dropdown menu is large. For some reason the menu goes up in this case. Is there a way to force it to always go down?

I was able to recreate it by going to http://www.dynamicdrive.com/dynamicindex1/anylinkcss.htm and adjusting my browser to be small, and the example pushes it to the top. This happens in any browser I try.

Thanks much!
hanji

jscheuer1
01-09-2009, 04:59 PM
It is supposed to do that. What this feature is really intended for is if the menu is lower on the page and/or scrolled near the bottom of an adequately sized window. In cases like that it allows the menu to still be seen and used.

But, if the browser window is too small, does it really matter where the drop down goes? The menu is still unusable.

Your drop downs should be short enough to fit in about 350px height. That way they will still be usable at 800 x 600 resolution, and fine for all of today's more common monitor resolutions.

However, if you still wish to disable this feature, find this function in the script file and comment out (red //) the highlighted lines as shown:


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=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
}

hanji
01-09-2009, 05:20 PM
Hello

Thanks for the reply. I tried this, but I'm receiving an error now.


return not in function

Odd thing is that edgeoffset is defined at the beginning of the function, so it should be able to return 0 there.

Here is my function...


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=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
}

Any ideas?
hanji

hanji
01-09-2009, 05:42 PM
I see the issue. Needed to comment out that curly `}` bracket. It's working now.

Thanks!
hanji