PDA

View Full Version : AnyLink CSS Menu: change the position of the menu



coruscantcity
03-28-2006, 03:09 PM
Script: AnyLink CSS Menu
http://www.dynamicdrive.com/dynamicindex1/anylinkcss.htm

Hello :D . Is there a way to change the position where this menu appears. If it possible to display it, not below the link, but at the end of it, as AnyLink Vertical Menu does ( http://www.dynamicdrive.com/dynamicindex1/anylinkvertical.htm )?

Thank you!

.alias.
03-28-2006, 03:12 PM
my i just ask y you cant use http://www.dynamicdrive.com/dynamici...nkvertical.htm
instead of your other code? im sure there is a reason but the best way just seems to be use the new code

jscheuer1
03-28-2006, 07:44 PM
Here is where, in anylink.js that the drop downs are revealed and their position is set:


function dropdownmenu(obj, e, dropmenuID){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
if (typeof dropmenuobj!="undefined") //hide previous menu
dropmenuobj.style.visibility="hidden"
clearhidemenu()
if (ie5||ns6){
obj.onmouseout=delayhidemenu
dropmenuobj=document.getElementById(dropmenuID)
if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
dropmenuobj.onmouseover=clearhidemenu
dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
showhide(dropmenuobj.style, e, "visible", "hidden")
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
return clickreturnvalue()
}

The line in red sets their left position. You could simply add some on:


dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+100+"px"

Or, for what you want, the right edge of the trigger may need to be found. Let me know if the above is good enough. This may get the trigger width:


dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"

untested.

coruscantcity
04-20-2006, 12:37 PM
Nop, It does not work. The menu appears randomly along the link (sometimes at the begining, other times in the middle, few times almost at the end!!!).

jscheuer1
04-20-2006, 02:43 PM
That's funny, it works here.