|
TopMenu; SubMenu + Top Merge. Now with pages.
|
|
Topic Started: Dec 4 2007, 03:50 PM (3,685 Views)
|
|
Tim
|
Dec 4 2007, 03:50 PM
Post #1
|
- Posts:
- 506
- Group:
- Members
- Member
- #38
- Joined:
- Nov 27, 2007
- What Browser are you using?
- Firefox 3
|
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.
|
|
|
| |
|
Eureka
|
Dec 4 2007, 03:55 PM
Post #2
|
- Posts:
- 402
- Group:
- Members
- Member
- #256
- Joined:
- Dec 1, 2007
|
I actually liked the top bar. But it's a nice code. BTW, you misspelled class <a cass>? XD
|
|
|
| |
|
Tim
|
Dec 4 2007, 03:58 PM
Post #3
|
- Posts:
- 506
- Group:
- Members
- Member
- #38
- Joined:
- Nov 27, 2007
- What Browser are you using?
- Firefox 3
|
- 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.
|
|
|
| |
|
Eureka
|
Dec 4 2007, 04:01 PM
Post #4
|
- Posts:
- 402
- Group:
- Members
- Member
- #256
- Joined:
- Dec 1, 2007
|
No that would just look horrible.
|
|
|
| |
|
Zefer
|
Dec 4 2007, 04:22 PM
Post #5
|
- Posts:
- 97
- Group:
- Members
- Member
- #132
- Joined:
- Nov 28, 2007
- What Browser are you using?
- Opera 9.5
|
That is soooo awesome
|
|
|
| |
|
Tim
|
Dec 4 2007, 05:13 PM
Post #6
|
- Posts:
- 506
- Group:
- Members
- Member
- #38
- Joined:
- Nov 27, 2007
- What Browser are you using?
- Firefox 3
|
- 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.
|
|
|
| |
|
Eureka
|
Dec 4 2007, 05:21 PM
Post #7
|
- Posts:
- 402
- Group:
- Members
- Member
- #256
- Joined:
- Dec 1, 2007
|
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.
|
|
|
| |
|
Tim
|
Dec 4 2007, 05:29 PM
Post #8
|
- Posts:
- 506
- Group:
- Members
- Member
- #38
- Joined:
- Nov 27, 2007
- What Browser are you using?
- Firefox 3
|
- 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.
|
|
|
| |
|
Eureka
|
Dec 4 2007, 05:32 PM
Post #9
|
- Posts:
- 402
- Group:
- Members
- Member
- #256
- Joined:
- Dec 1, 2007
|
- 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.
|
|
|
| |
|
Tim
|
Dec 4 2007, 05:58 PM
Post #10
|
- Posts:
- 506
- Group:
- Members
- Member
- #38
- Joined:
- Nov 27, 2007
- What Browser are you using?
- Firefox 3
|
- 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 
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.
|
|
|
| |
| 1 user reading this topic (1 Guest and 0 Anonymous)
|