Welcome Guest [Log In] [Register]
This board has been archived and is no longer accepting new questions. If you have a support question for your ZetaBoard, please visit us at the new support board. Registration is free and easy.


Visit the NEW ZetaBoards Support forum!

Username:   Password:
Add Reply
TopMenu; SubMenu + Top Merge. Now with pages.
Topic Started: Dec 4 2007, 03:50 PM (3,685 Views)
Tim
Member Avatar
Timmeh
[ *  *  *  * ]
Top + SubMenu Merge.

It uses jQuery to select and remove some parts not needed.
(If anyone has any idea how I can automaticaly list the webpages rather than have to add them, please PM me.)

Edit the variables accordingly.
Code:
 
var url = the image on the submenu tabs url.
var url2 = the image for Pages tab.
var place = the placement of the bar. "#logo" is above the logo, "#wrap" is bellow
var wp = Choose whether to include webpages. 0 no, 1 yes.
var sm = Choose whether to condence submenu on to the bar. 0 no, 1 yes
var wpid = an array of the ID of your pages.
var wpname = the name you want displayed for the corresponding webpage.

Feel free to edit, leave copywrite please.

Preview

Code: HTML
 
<script>
/*Tim - TopMenu Merge */

var url = "http://209.85.62.24/static/1/m_acp.png";
var url2 = "http://209.85.62.24/static/1/m_acp.png";
var place ="#logo";
var wp = 1;
var sm = 1;
var wpid = new Array("testpages333","pagetest1");
var wpname = new Array("TestPage","PageTest");

$(document).ready(function(){
var htmlStr = $("#top_info").html();
var htmlStr3 = $("#top_menu").html();
if (htmlStr3 == null){htmlStr3 = "";}
var htmlStr2 = $("#submenu").html();
htmlStr2 = "<li id=\"menu_ucp\"><a><img src='" + url + "' alt='ACP' />Submenu</a><ul><li>" + htmlStr2 + "</li></ul></li>";
if (wp == 1) {
htmlStr4 = "<li id=\"menu_ucp\"><a><img src='" + url2 + "' alt='ACP' />Pages</a><ul><li>";
for(i=0;i<wpid.length;i++){ htmlStr4 += "<a href=\"" + main_url + "pages/" + wpid[i] +"\">" + wpname[i] + "</a>"; }
htmlStr4 += "</li></ul></li>";
} else {var htmlStr4 = "";}
if (sm == 1) { $("#submenu").remove(); } else { htmlStr2 = ""; }
$("#top").remove();$("#top_bar").remove();;$("#submenu_bar").remove();
$(place).prepend("<div id=\"top\"><div id=\"top_info\">" + htmlStr + "</div><ul id=\"top_menu\" class=\"drop_menu\">" +htmlStr4 + htmlStr2 + htmlStr3 + "</ul></div>");
});
</script>


Also, someone wanted to use this with my floating menu, and I have edited it a bit to come up with this. Edit the variables as before.

Code: HTML
 

<script>
/*TopMenu Merge with Fixed Floating #top by Tim. */
var url = "http://209.85.62.24/static/1/m_acp.png";
var url2 = "http://209.85.62.24/static/1/m_acp.png";
var wp = 1;
var sm = 1;
var wpid = new Array("testpages333","pagetest1");
var wpname = new Array("TestPage","PageTest");


$("#top").after("<br /><br />");
$("#top_bar").remove();
$("#top").css({position:"fixed"});
$("#top").css({"padding-right": "1px"});
$(document).ready(function(){
var htmlStr = $("#top_info").html();
var htmlStr3 = $("#top_menu").html();
if (htmlStr3 == null){htmlStr3 = "";}
var htmlStr2 = $("#submenu").html();
htmlStr2 = "<li id=\"menu_ucp\"><a><img src='" + url + "' alt='ACP' />Submenu</a><ul><li>" + htmlStr2 + "</li></ul></li>";
if (wp == 1) {
htmlStr4 = "<li id=\"menu_ucp\"><a><img src='" + url2 + "' alt='ACP' />Pages</a><ul><li>";
for(i=0;i<wpid.length;i++){ htmlStr4 += "<a href=\"" + main_url + "pages/" + wpid[i] +"\">" + wpname[i] + "</a>"; }
htmlStr4 += "</li></ul></li>";
} else {var htmlStr4 = "";}
if (sm == 1) { $("#submenu").remove(); } else { htmlStr2 = ""; }
$("#top_bar").remove();;$("#submenu_bar").remove();
$("#top").html("<div id=\"top\"><div id=\"top_info\">" + htmlStr + "</div><ul id=\"top_menu\" class=\"drop_menu\">" +htmlStr4 + htmlStr2 + htmlStr3 + "</ul></div>");
});
</script>
Edited by Tim, Dec 6 2007, 05:22 PM.
Offline Profile Quote Post Goto Top
 
Eureka
Member
[ *  *  * ]
I actually liked the top bar. But it's a nice code. BTW, you misspelled class <a cass>? XD
Offline Profile Quote Post Goto Top
 
Tim
Member Avatar
Timmeh
[ *  *  *  * ]
Ken
Dec 4 2007, 03:55 PM
I actually liked the top bar. But it's a nice code. BTW, you misspelled class <a cass>? XD
So I did! Thank you =]

Maybe Ill do a Top Only version, moving the submenu to the Top.
Offline Profile Quote Post Goto Top
 
Eureka
Member
[ *  *  * ]
No that would just look horrible.
Offline Profile Quote Post Goto Top
 
Zefer
Member Avatar
I <3 PHP
[ *  * ]
That is soooo awesome :D
Offline Profile Quote Post Goto Top
 
Tim
Member Avatar
Timmeh
[ *  *  *  * ]
Ken
Dec 4 2007, 04:01 PM
No that would just look horrible.
LOL

I have edited it slightly so that you can choose whether to have the bar above or bellow the logo.
Offline Profile Quote Post Goto Top
 
Eureka
Member
[ *  *  * ]
Suggestion, instead of fiddling with that (lol), since Mwr247 already made one similar to this, implement a feature for websites. Gotta store the links somewhere right? I was thinking of making it in conjunction with my TopMenu code, but since you already have it out, it'll be redundant to post mine. So yeah, implement the website links onto there.
Offline Profile Quote Post Goto Top
 
Tim
Member Avatar
Timmeh
[ *  *  *  * ]
Ken
Dec 4 2007, 05:21 PM
Suggestion, instead of fiddling with that (lol), since Mwr247 already made one similar to this, implement a feature for websites. Gotta store the links somewhere right? I was thinking of making it in conjunction with my TopMenu code, but since you already have it out, it'll be redundant to post mine. So yeah, implement the website links onto there.
Okay, Ill have a look at that. The only problem is it depends what websites you want to display, some might be private use only. Ill look into it though.
Offline Profile Quote Post Goto Top
 
Eureka
Member
[ *  *  * ]
Tim
Dec 4 2007, 05:29 PM
Ken
Dec 4 2007, 05:21 PM
Suggestion, instead of fiddling with that (lol), since Mwr247 already made one similar to this, implement a feature for websites. Gotta store the links somewhere right? I was thinking of making it in conjunction with my TopMenu code, but since you already have it out, it'll be redundant to post mine. So yeah, implement the website links onto there.
Okay, Ill have a look at that. The only problem is it depends what websites you want to display, some might be private use only. Ill look into it though.
Doesn't matter. Just make an array. Have it store the Name of the site and the website link. So a two-dimensional array. :)

This was intended for the website maker thing at first, but we can generalize.
Offline Profile Quote Post Goto Top
 
Tim
Member Avatar
Timmeh
[ *  *  *  * ]
Ken
Dec 4 2007, 05:32 PM
Tim
Dec 4 2007, 05:29 PM
Ken
Dec 4 2007, 05:21 PM
Suggestion, instead of fiddling with that (lol), since Mwr247 already made one similar to this, implement a feature for websites. Gotta store the links somewhere right? I was thinking of making it in conjunction with my TopMenu code, but since you already have it out, it'll be redundant to post mine. So yeah, implement the website links onto there.
Okay, Ill have a look at that. The only problem is it depends what websites you want to display, some might be private use only. Ill look into it though.
Doesn't matter. Just make an array. Have it store the Name of the site and the website link. So a two-dimensional array. :)

This was intended for the website maker thing at first, but we can generalize.
Yeah, I should have done a 2 dimensional array, I just did two separate arrays :P

The links aren't coming out properly at the moment, any ideas why?

(Added the ability to turn pages and submenu moving off.)
Code: HTML
 
<script>
/*Tim - TopMenu Merge */
/*url is the image on the submenu tabs url. url2 is the image for Pages tab.*/
/*Place is the placement of the bar. "#logo" is above the logo, "#wrap" is bellow */
/*Choose whether to include webpages. 0 no, 1 yes */
/*wpid is an array of the ID of your pages. wpname is the name for the webpage */

var url = "http://209.85.62.24/static/1/m_acp.png";
var url2 = "http://209.85.62.24/static/1/m_acp.png";
var place ="#logo";
var wp = 1;
var sm = 0;
var wpid = new Array("testpages333","pagetest1");
var wpname = new Array("TestPage","PageTest");

$(document).ready(function(){
var htmlStr = $("#top_info").html();
var htmlStr3 = $("#top_menu").html();
if (htmlStr3 == null){htmlStr3 = "";}
var htmlStr2 = $("#submenu").html();
htmlStr2 = "<li id=\"menu_ucp\"><a><img src='" + url + "' alt='ACP' />Submenu</a><ul><li>" + htmlStr2 + "</li></ul></li>";

if (wp == 1) {
htmlStr4 = "<li id=\"menu_ucp\"><a><img src='" + url2 + "' alt='ACP' />Pages</a><ul><li>";
for(i=0;i<wpid.length;i++){
htmlStr4 += "<a href\"" + main_url +"/pages/" + wpid[i] +"/>" + wpname[i] + "</a>";
}
htmlStr4 += "</li></ul></li>";
} else {
var htmlStr4 = "";
}

if (sm == 1) {
$("#submenu").remove();
} else {
htmlStr2 = "";
}
$("#top").remove();$("#top_bar").remove();;$("#submenu_bar").remove();
$(place).prepend("<div id=\"top\"><div id=\"top_info\">" + htmlStr + "</div><ul id=\"top_menu\" class=\"drop_menu\">" +htmlStr4 + htmlStr2 + htmlStr3 + "</ul></div>");
});
</script>
Edited by Tim, Dec 4 2007, 06:02 PM.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · User Created Codes · Next Topic »
Add Reply