Seite 1 von 1

Brauche Ein/Umbauanleitung für Javascript

Verfasst: 01.08.2006 21:27
von Tommy_65428
Hallo,

mir wurde eine Frage gestellt, die weder ich noch jemand anderes aus meinem "bekanntenkreis" beantworten kann. Da ich die Idee aber nicht schlecht finde, brauche ich mal eine Schritt für Schritt Anleitung (Also eine Ein/Umbauanleitung) wie man das machen muss.

Und zwar haben die phpBB-Plus Foren (Die weder ich noch mein Bruder betreiben :D ) im Header den Kalender zum ein-und ausklappen.

Diese Funktion würden wir gerne benutzen um die komplette navi des Headers (Profil, FAQ, Nachrichten etc. etc. pp.) unter einen Link (z.B. Navigation" oder ähnliches) zu legen, der mit einem Klick die Navigation öffnet und ebenso wieder schliesst nach einem weiteren Klick.

Das Javascript liegt ja nun bereits schon vor:

Code: Alles auswählen

function hdr_ref(object)
{
	if (document.getElementById)
	{
		return document.getElementById(object);
	}
	else if (document.all)
	{
		return eval('document.all.' + object);
	}
	else
	{
		return false;
	}
}

function hdr_expand(object)
{
	var object = hdr_ref(object);

	if( !object.style )
	{
		return false;
	}
	else
	{
		object.style.display = '';
	}

	if (window.event)
	{
		window.event.cancelBubble = true;
	}
}

function hdr_contract(object)
{
	var object = hdr_ref(object);

	if( !object.style )
	{
		return false;
	}
	else
	{
		object.style.display = 'none';
	}

	if (window.event)
	{
		window.event.cancelBubble = true;
	}
}

function hdr_toggle(object, open_close, open_icon, close_icon)
{
	var object = hdr_ref(object);
	var icone = hdr_ref(open_close);

	if( !object.style )
	{
		return false;
	}
Jetzt ist nur die Frage wie man das in der overall_header "einbauen" muss, damit die Navi ein-und ausklappbar ist.

Hier ist auch noch der Teil der calendar_box_tpl aus den Plus Foren:

Code: Alles auswählen

<!-- The javascript presents here comes from MyCalendar 2.2.6 from MojavLinux -->
<script language="Javascript" type="text/javascript">
<!--
var agt = navigator.userAgent.toLowerCase();
var originalFirstChild;

function createTitle(which, string, x, y) 
{
	// record the original first child (protection when deleting)
	if (typeof(originalFirstChild) == 'undefined') 
	{
		originalFirstChild = document.body.firstChild;
	}

	x = document.all ? (event.clientX + document.body.scrollLeft) : x;
	y = document.all ? (event.clientY + document.body.scrollTop) : y;
	element = document.createElement('div');
	element.style.position = 'absolute';
	element.style.zIndex = 1000;
	element.style.visibility = 'hidden';
	excessWidth = 0;
	if (document.all) 
	{
		excessWidth = 50;
	}
	excessHeight = 20;
	element.innerHTML = '<div class="bodyline"><table width="300" cellspacing="0" cellpadding="0" border="0"><tr><td><table width="100%"><tr><td><span class="gen">' + string + '</span></td></tr></table></td></tr></table></div>';
	renderedElement = document.body.insertBefore(element, document.body.firstChild);
	renderedWidth = renderedElement.offsetWidth;
	renderedHeight = renderedElement.offsetHeight;

	// fix overflowing off the right side of the screen
	overFlowX = x + renderedWidth + excessWidth - document.body.offsetWidth;
	x = overFlowX > 0 ? x - overFlowX : x;

	// fix overflowing off the bottom of the screen
	overFlowY = y + renderedHeight + excessHeight - window.innerHeight - window.pageYOffset;
	y = overFlowY > 0 ? y - overFlowY : y;

	renderedElement.style.top = (y + 15) + 'px';
	renderedElement.style.left = (x + 15) + 'px';

	// windows versions of mozilla are like too fast here...we have to slow it down
	if (agt.indexOf('gecko') != -1 && agt.indexOf('win') != -1) 
	{
		setTimeout("renderedElement.style.visibility = 'visible'", 1);
	}
	else 
	{
		renderedElement.style.visibility = 'visible';
	}
}

function destroyTitle() 
{
	// make sure we don't delete the actual page contents (javascript can get out of alignment)
	if (document.body.firstChild != originalFirstChild) 
	{
		document.body.removeChild(document.body.firstChild);
	}
}
//-->
</script>
Gibt es hier jemanden der sich damit auskennt und uns beiden Anfängern eine Einbauanleitung schreiben könnte ? :oops:

Vielen Dank schonmal im vorraus :grin:

Verfasst: 02.08.2006 16:21
von Tommy_65428
Zeigt doch Gnade und helft mir :oops: :oops:

Verfasst: 02.08.2006 19:19
von Tommy_65428
Habe dank der Denkanstösse auf einem anderen Support-Board schliesslich doch noch hinbekommen.

Hier kann geschlossen werden.

Danke Oxpus :wink: