PDA

View Full Version : Accordion Bullet Menu header links with submenus not working



carterj
04-03-2009, 03:42 PM
1) Script Title: Bullet List Accordion Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-bullet.htm

3) Describe problem:

We have the menu working fine, except we want to be able to click on a menu header, a new page is to display and then the sub menus to also be able to show. This should be possible by using the persist state as detailled in this forum response, which is set correctly:

http://www.dynamicdrive.com/forums/showthread.php?t=41719


HOWEVER - we seem to have a different problem, whereby if you rollover your mouse on the header link, the status bar shows that it is coded correctly to link to a dedicated url page, but when you click the header link, the submenu drops down correctly, but the page does not change.

If we change the menu script settings to on mouseover rather than onclick, it woks fine and allows us to click on the menu headings and the link works, but we want it onclick.


Many Thanks

ddadmin
04-03-2009, 09:43 PM
Try upgrading to the latest v1.7 of the script (only the .js file changed (http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm)). Then, in your settings.js file, change the line in red to the below value:


ddaccordion.init({
headerclass: "expandable", //Shared CSS class name of headers group that are expandable
contentclass: "categoryitems", //Shared CSS class name of contents group
revealtype: "clickgo", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
animatedefault: false, //Should contents open by default be animated into view?
persiststate: true, //persist state of opened contents within browser session?
toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
animatespeed: "slow", //speed of animation: "fast", "normal", or "slow"
oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
//do nothing
},
onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
//do nothing
}
})

What this does is cause the headers to still expand onClick, but after its sub contents have expanded, also take the user to the URL defined inside the header.

carterj
04-04-2009, 07:55 PM
Thats fixed it !

Much appreciated.

Kind Regards

mikie
12-12-2014, 09:21 AM
Hello

I know this is an old thread but my question is relevant to this thread. My hyperlinks work 100% the only problem that I have is that it is not opening the link in the target frame I have.

<div class="menuheader expandable"><div><span class="span"><a href="Home/home.aspx" target="iframe" id="home" runat="server">Home</a></span></div></div>

and the frame

<iframe id="iframe" name="iframe" src="Home/home.aspx" runat="server" frameborder="0" scrolling="no" width="780" height="659"></iframe>

when it opens the link it opens it over the whole page.

and I think it has something to do with the following:

if (config.postreveal == "gotourl" && directclick) { //if revealtype is "Go to Header URL upon click", and this is a direct click on the header
var targetLink = ($targetHeader.is("a")) ? $targetHeader.get(0) : $targetHeader.find('a:eq(0)').get(0)
if (targetLink) //if this header is a link
setTimeout(function () { location = targetLink.href }, 200 + (scrolltoheader ? 400 + sthdelay : 0)) //ignore link target, as window.open(targetLink, targetLink.target) doesn't work in FF if popup blocker enabled
}

adding window.open(targetLink, targetLink.target) works but then all the headers are open and do not close

mikie
12-12-2014, 10:20 AM
Got it, just removed setTimeout(function () { location = targetLink.href }, 200 + (scrolltoheader ? 400 + sthdelay : 0)) and replaced it with window.open(targetLink, targetLink.target) and it worked