Irishjugg
11-12-2008, 03:10 PM
1) Script Title: AnyLink Drop Down Menu and Ajax Tabs
2) Script URL (on DD):
(http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm)
and
http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm
3) Describe problem:
I am trying to get ajax tabs to work together with the "AnyLink Drop Down Menu" script. So far, the closest thing to being sucessful I had was to actually put all of the ajaxtabs.js file code into the menus.js file from AnyLink (ugly solution, but I dont know how to do the equivalent of an include in javascript) and then alter the menus.js code here:
function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)
if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
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()
//return true;
}
to :
function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)
if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
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"
}
// Hack in ajax tabs?
var admin=new ddajaxtabs("dropmenudiv", "inner")
admin.setpersist(false)
admin.setselectedClassTarget("link") //"link" or "linkparent"
admin.init()
//
return clickreturnvalue()
//return true;
}
which made the script work, however whenever I even hovered over the parent link that spawns the drop down menu, the ajax fetch would happen and whatever page had been loaded into the container div would disappear. I tried moving the admin.init() to several different places but could not find a configuration that did not either destroy my original functionality, or that allowed the new functionality I wanted.
Is there a solution for merging the two scripts that exists already?
I have a demo page set up, at this location:
Demo Page (http://web.science.nd.edu/bestbuddies/playground/welcome.php)
The anylink drop down is the admin button on the right, all the links point to the same dummy page. The goal is to get them to load into the same contennt div (called "inner") as the other buttons on the top bar menu, they use ajax tabs.
some code for the admin button creation:
<a href="admin.php" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu1, '150px')" onMouseout="delayhidemenu()">
<li class="topbars">Admin</li>
</a>
and for the other links that use ajax tabs:
<li class="topbars"><a href="#" rel="#default" class="selected">Home</a></li>
<li class="topbars"><a href="mybuddy.php" rel="inner">About</a></li>
<li class="topbars"><a href="external.php" rel="inner">Event Schedule</a></li>
<li class="topbars"><a href="external.php" rel="inner">Officers</a></li>
and finally ajax tabs instantiation:
var tabs=new ddajaxtabs("tabbar", "inner")
tabs.setpersist(false)
tabs.setselectedClassTarget("link") //"link" or "linkparent"
tabs.init()
If anyone has any suggestions, I have tried several different things and as I said above, to varying success.
Thanks to ddadmin for requesting I start this as a new thread and for your previous help.
2) Script URL (on DD):
(http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm)
and
http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm
3) Describe problem:
I am trying to get ajax tabs to work together with the "AnyLink Drop Down Menu" script. So far, the closest thing to being sucessful I had was to actually put all of the ajaxtabs.js file code into the menus.js file from AnyLink (ugly solution, but I dont know how to do the equivalent of an include in javascript) and then alter the menus.js code here:
function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)
if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
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()
//return true;
}
to :
function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)
if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
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"
}
// Hack in ajax tabs?
var admin=new ddajaxtabs("dropmenudiv", "inner")
admin.setpersist(false)
admin.setselectedClassTarget("link") //"link" or "linkparent"
admin.init()
//
return clickreturnvalue()
//return true;
}
which made the script work, however whenever I even hovered over the parent link that spawns the drop down menu, the ajax fetch would happen and whatever page had been loaded into the container div would disappear. I tried moving the admin.init() to several different places but could not find a configuration that did not either destroy my original functionality, or that allowed the new functionality I wanted.
Is there a solution for merging the two scripts that exists already?
I have a demo page set up, at this location:
Demo Page (http://web.science.nd.edu/bestbuddies/playground/welcome.php)
The anylink drop down is the admin button on the right, all the links point to the same dummy page. The goal is to get them to load into the same contennt div (called "inner") as the other buttons on the top bar menu, they use ajax tabs.
some code for the admin button creation:
<a href="admin.php" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu1, '150px')" onMouseout="delayhidemenu()">
<li class="topbars">Admin</li>
</a>
and for the other links that use ajax tabs:
<li class="topbars"><a href="#" rel="#default" class="selected">Home</a></li>
<li class="topbars"><a href="mybuddy.php" rel="inner">About</a></li>
<li class="topbars"><a href="external.php" rel="inner">Event Schedule</a></li>
<li class="topbars"><a href="external.php" rel="inner">Officers</a></li>
and finally ajax tabs instantiation:
var tabs=new ddajaxtabs("tabbar", "inner")
tabs.setpersist(false)
tabs.setselectedClassTarget("link") //"link" or "linkparent"
tabs.init()
If anyone has any suggestions, I have tried several different things and as I said above, to varying success.
Thanks to ddadmin for requesting I start this as a new thread and for your previous help.