News - Features - Downloads - Forum - Team - Support - Switch View: Screen
Login - Registrierung - Passwort vergessen

Antworten: 4
Seite [1]
Likka


Rock the board




Beiträge: 42
# Thema - 28.12.2007 um 22:01 Uhr
Moinsen, ich habe da ein submenu das von Anfang an ausgeklappt ist, nun ich möchte aber gern das es beim laden der seite zusammen ist. Weiss jemand von Euch was geändert werden muss?

TEST SEITE

menu.js : var remember = true; //Remember menu states, and restore them on next visit.
var contractall_default= true; //Should all submenus be contracted by default? (true or false)

var menu, titles, submenus, bypixels;
var heights = new Array();

var n = navigator.userAgent;
if(/Opera/.test(n)) bypixels = 2;
else if(/Firefox/.test(n)) bypixels = 3;
else if(/MSIE/.test(n)) bypixels = 2;

/////DD added expandall() and contractall() functions/////

function slash_expandall()
{
if (typeof menu!="undefined")
{
for(i=0; i<Math.max(titles.length, submenus.length); i++)
{
titles[i].className="tittle";
submenus[i].style.display="";
submenus[i].style.height = heights[i]+"px";
}
}
}
function slash_contractall()
{
if (typeof menu!="undefined")
{
for(i=0; i<Math.max(titles.length, submenus.length); i++)
{
titles[i].className="tittlehidden";
submenus[i].style.display="none";
submenus[i].style.height = 0;
}
}
}


/////End DD added functions///////////////////////////////


function init()
{
menu = getElementsByClassName("sdmenu", "div", document)[0];
titles = getElementsByClassName("tittle", "span", menu);
submenus = getElementsByClassName("submenu", "div", menu);
for(i=0; i<Math.max(titles.length, submenus.length); i++)
{
titles[i].onclick = gomenu;
heights[i] = submenus[i].offsetHeight;
submenus[i].style.height = submenus[i].offsetHeight+"px";
}
if(remember)
restore()
else if (contractall_default) //DD added code
slash_contractall() //DD added code
}

function restore()
{
if(getcookie("menu") != null)
{
var hidden = getcookie("menu").split(",");
for(var i in hidden)
{
titles[hidden[i]].className = "tittlehidden";
submenus[hidden[i]].style.height = "0px";
submenus[hidden[i]].style.display = "none";
}
}
}

function gomenu(e)
{
if (!e)
var e = window.event;

var ce = (e.target) ? e.target : e.srcElement;
var sm;
for(var i in titles)
{
if(titles[i] == ce)
sm = i;
}
if(parseInt(submenus[sm].style.height) > parseInt(heights[sm])-2)
hidemenu(sm);
else if(parseInt(submenus[sm].style.height) < 2)
{
titles[sm].className = "tittle";
showmenu(sm);
}
}

function hidemenu(sm)
{
var nr = submenus[sm].getElementsByTagName("a").length*bypixels;
submenus[sm].style.height = (parseInt(submenus[sm].style.height)-nr)+"px";
var to = setTimeout("hidemenu("+sm+")", 30);
if(parseInt(submenus[sm].style.height) <= nr)
{
clearTimeout(to);
submenus[sm].style.display = "none";
submenus[sm].style.height = "0px";
titles[sm].className = "tittlehidden";
}
}

function showmenu(sm)
{
var nr = submenus[sm].getElementsByTagName("a").length*bypixels;
submenus[sm].style.display = "";
submenus[sm].style.height = (parseInt(submenus[sm].style.height)+nr)+"px";
var to = setTimeout("showmenu("+sm+")", 30);
if(parseInt(submenus[sm].style.height) > (parseInt(heights[sm])-nr))
{
clearTimeout(to);
submenus[sm].style.height = heights[sm]+"px";
}
}

function store() {
var hidden = new Array();
for(var i in titles) {
if(titles[i].className == "tittlehidden")
hidden.push(i);
}
putcookie("menu", hidden.join(","), 30);
}

function getElementsByClassName(strClassName, strTagName, oElm){
var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
var arrReturnElements = new Array();
strClassName = strClassName.replace(/\-/g, "\\-");
var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
var oElement;
for(var i=0; i<arrElements.length; i++){
oElement = arrElements[i];
if(oRegExp.test(oElement.className)){
arrReturnElements.push(oElement);
}
}
return (arrReturnElements)
}

function putcookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie = c_name + "=" + escape(value) + ((expiredays==null) ? "" : ";expires="+exdate);
}

function getcookie(c_name)
{
if(document.cookie.length > 0)
{
var c_start = document.cookie.indexOf(c_name + "=");
if(c_start != -1)
{
c_start = c_start + c_name.length + 1;
var c_end = document.cookie.indexOf(";",c_start);
if(c_end == -1)
c_end = document.cookie.length;

return unescape(document.cookie.substring(c_start, c_end));
}
}
return null;
}

window.onload = init;
if(remember) window.onunload = store;

menu.css : .sdmenu {
width: 222px;
font-family: Verdana;
font-size: 12px;
padding-bottom: 0px;
color: #FFF;
}

.sdmenu .tittle{
font-size: 14px;
text-indent: 28px;
display: block;
padding-bottom: 9;
padding-top: 8;
font-weight: bold;
color: #ffffff;
background: #FFF url(../images/menu_head_open.gif) repeat-x;
}

.sdmenu .tittlehidden{
font-size: 14px;
text-indent: 28px;
display: block;
padding-bottom: 9;
padding-top: 8;
font-weight: bold;
color: #f5f5f5;
background: #FFF url(../images/menu_head_closed.gif) repeat-x;
}

.sdmenu .tittle {
border-bottom: 0px solid #DDD;
}

.sdmenu .arrow {
margin-left: 10px;
margin-right: 7px;
}

.sdmenu .titlehidden {
border-bottom: none;
}

.sdmenu .submenu {
overflow: hidden;
}

.sdmenu .submenu a {
background : #066 url(../images/menu_mout.gif) no-repeat left center;
padding-bottom: 10;
padding-top: 9;
text-indent: 20px;
display: block;
color: #e1e1e1;
text-decoration: none;
FONT-WEIGHT: BOLD;
}

.sdmenu .submenu a:hover {
background : #066 url(../images/menu_mover.gif) no-repeat left center;
text-indent: 30px;
color: #ffffff;
}

div : <div class="sdmenu">
<span class="tittle"><img src="images/dummy.gif">Information</span>
<div class="submenu">
<a href="http://www.">News</a>
<a href="http://www.">News archiv</a>
<a href="http://www.">News search</a>
<a href="http://www.">Artikel</a>
<a href="http://www.">Events</a>
</div>
<span class="tittle"><img src="images/dummy.gif">Media</span>
<div class="submenu">
<a href="http://www.">Downloads</a>
<a href="http://www.">Links</a>
<a href="http://www.">Gallery</a>
<a href="http://www.">Sponsors</a>
<a href="http://www.">Contact</a>
</div>
<span class="tittle"><img src="images/dummy.gif">Clan</span>
<div class="submenu">
<a href="http://www.">Member</a>
<a href="http://www.">Matches</a>
<a href="http://www.">Server</a>
<a href="http://www.">Awards</a>
<a href="http://www.">History</a>
</div>
<span class="tittle"><img src="images/dummy.gif">Community</span>
<div class="submenu">
<a href="http://www.">Forum</a>
<a href="http://www.">Shop</a>
<a href="http://www.">Polls</a>
<a href="http://www.">Userlist</a>
<a href="http://www.">FAQ</a>
</div>
</div>
Inaktiv
donkeydick


Try to beat me





Beiträge: 161
# Antwort: 1 - 28.12.2007 um 22:10 Uhr
Zieh Dir das mal bitte: Klick und schau Dir das mal an, da habe ich es hinbekommen, das es von Anfang an zugeklappt ist.

Greetz
donkeydick


Inaktiv
|
Likka
Thread-Ersteller


Rock the board




Beiträge: 42
# Antwort: 2 - 28.12.2007 um 22:16 Uhr
Jaaaaaa es geht, fettes THX man.

*** Kann closed werden ***


Zuletzt editiert von Likka am 28.12.2007 um 22:17 Uhr (1x Editiert)
Inaktiv
|
donkeydick


Try to beat me





Beiträge: 161
# Antwort: 3 - 28.12.2007 um 22:21 Uhr
hehe kein Problem, gern geschehen


Inaktiv
|
TeQu!La ClanSphere Team


Specialist




Herkunft: Grevenbroich
Beiträge: 2142
# Antwort: 4 - 29.12.2007 um 01:33 Uhr
ok


------------------

ClanSphere - professional clan care starts here


Inaktiv
|

Dieses Thema wurde von TeQu!La ClanSphere Team PM geschlossen.

Antworten: 4
Seite [1]




ClanSphere Project - Mailus - Imprint - Disclaimer - Scriptinfo