Recent Questions Tree Menu Code Brainjar
Q: Is there a different type of menu, other than the way I have it set up, such as the tree type, that might load faster or take up less space when the page loads?
A: You should set
var dmAJAX=1;
create .js files with your submenus and call this files from your mainfile, for example:
var menuItems = [
["Home","testlink.htm"],
["Product Info","", , , , , , , "data-samples/data-ajax2.js", ],
["Samples","", , , , , , , "data-samples/data-ajax3.js", ],
["Purchase","testlink.htm"],
["Contact Us","testlink.htm"],
];
/*** data-ajax2.js ****/
var menuItems = [
["Features","testlink.htm"],
["Installation",""],
["Parameters Info","testlink.htm"],
["Dynamic Functions","testlink.htm"],
["Supported Browsers",""],
];
Add dmenu_ajax.js file in the same folder with your dmenu.js file.
Try that.
Q: Thank you. I got the menu working on my web page.
Now, I have to pass dynamic value from the link when the user click the floating javascript menu.
I was using a table type of menu and passing value like this
<td onclick="document.iframename.location.href='abc.jsp?value1=<%value1%>&value2=<%value2%>Click here</td>
What should I do to the deluxe-menu to get the same action?
I need to pass value to next page. The value is dynamic, so I have to use <%value1%> notation for JSP file.
A: Actually you can use your own Javascript code instead standard links. For example:
var menuItems = [
["text", "javascript:your_code_here"]
];
or
var menuitems = [
["<div onClick='your_code_here'>item text</div>", ""]
];
Q: However, when I place it inside a CSS-defined div element (for absolute page placement) the submenu's all drop down a couple hundred pixels.
A: See, the problem is that the script can't get css properties of the object if they are described in separate .css block (or file).In other words, you can't get the value of "POSITION: absolute" attribute of the object if the object doesn't have this property within inline style (style="POSITION:absolute;"). To get the value you should move .css style into style="" attribute.
Please, try to add your
css file -> inline css, for example:
You should add style="POSITION: absolute;"
to the
<div id="menu">
So, you'll have:
<DIV id="menu" style="POSITION: absolute;">
Try that.
Q: I am having problems with my html files that are located in sub folders of my site the menu html does not work on them.If they are in the root directory there is no problem.
A: You can use additional parameters to make menu paths absolute:
var pathPrefix_img = "http://domain.com/images/";
var pathPrefix_link = "http://domain.com/pages/";
These parameters allow to make images and links paths absolute.
For example:
var pathPrefix_img = "http://domain.com/images/";
var pathPrefix_link = "http://domain.com/pages/";
var menuItems = [
["text", "index.html", "icon1.gif", "icon2.gif"],
];
So, link path will be look so:
http://domain.com/pages/index.html
Images paths will be look so:
http://domain.com/images/icon1.gif
http://domain.com/images/icon2.gif