egroupware/phpgwapi/templates/idots/js/simple_show_hide.js
Pim Snel 07dd063def i-dots changes:
-  lay-out fixes in header
-  background in loginscreen to make it a little less boring
-  IE fix for wrong z-index with Selectboxes: temporarely hide selectboxes when showing menulayers
-  extra option to disable IE png fix
-  extra option to choose Click or Mouse Over to show menu's
-  extra option to auto hide sideboxmenu's (a lot of people will like this)
-  extra option to use sliders for showing menu, default enabled (see testresults below):

Mozilla-firebird Windows -> OK
Mozilla-firebird Linux -> OK
Internet Explorer 6.0 Windows 2000 - OK
Konqueror 3.1 Linux -> gets very slow, lay-out bugs (don't use this option with konqueror)
Opera 6 Linux -> showing works, hiding not, lay-out bugs (test again please)
Opera 7 Linux -> very annoing bug with temporarely hiding selectboxes (must not be hard to fix, pathes are welcome)

please also test this with Safari, Mac IE 5,  Win IE 5.0 and 5.5 and report bugs at sf
2003-12-15 00:05:28 +00:00

184 lines
4.2 KiB
JavaScript

/*****************************************************
* ypSlideOutMenu
* 3/04/2001
*
* a nice little script to create exclusive, slide-out
* menus for ns4, ns6, mozilla, opera, ie4, ie5 on
* mac and win32. I've got no linux or unix to test on but
* it should(?) work...
*
* --youngpup--
*****************************************************/
//var isIE = false;
//var isOther = false;
//var isNS4 = false;
//var isNS6 = false;
// constructor
function ypSlideOutMenu(id, dir, left, top, width, height,pos)
{
this.ie = document.all ? 1 : 0
this.ns4 = document.layers ? 1 : 0
this.dom = document.getElementById ? 1 : 0
if (this.ie || this.ns4 || this.dom) {
this.id = id
this.dir = dir
this.orientation = dir == "left" || dir == "right" ? "h" : "v"
this.dirType = dir == "right" || dir == "down" ? "-" : "+"
this.dim = this.orientation == "h" ? width : height
//this.hideTimer = false
//this.aniTimer = false
this.open = false
this.over = false
//this.startTime = 0
// global reference to this object
//this.gRef = "ypSlideOutMenu_"+id
//eval(this.gRef+"=this")
// add this menu object to an internal list of all menus
//ypSlideOutMenu.Registry[id] = this
var d = document
var strCSS = '<style type="text/css">';
strCSS += '#' + this.id + 'Container { visibility:hidden; '
if(pos)
{
strCSS += pos+':' + left + 'px; '
}
else
{
strCSS += 'left:' + left + 'px; '
}
strCSS += 'top:' + top + 'px; '
strCSS += 'overflow:visible; z-index:10000; }'
strCSS += '#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; '
strCSS += 'width:' + width + 'px; '
// strCSS += 'height:' + height + 'px; '
// strCSS += 'clip:rect(0 ' + width + ' ' + height + ' 0); '
strCSS += '}'
strCSS += '</style>';
d.write(strCSS);
// alert(strCSS);
// this.load()
}
}
ypSlideOutMenu.aLs = function(layerID)
{
this.isIE = false;
this.isOther = false;
this.isNS4 = false;
this.isNS6 = false;
if(document.getElementById)
{
if(!document.all)
{
this.isNS6=true;
}
if(document.all)
{
this.isIE=true;
}
}
else
{
if(document.layers)
{
this.isNS4=true;
}
else
{
this.isOther=true;
}
}
var returnLayer;
if(this.isIE)
{
returnLayer = eval("document.all." + layerID + ".style");
}
if(this.isNS6)
{
returnLayer = eval("document.getElementById('" + layerID + "').style");
}
if(this.isNS4)
{
returnLayer = eval("document." + layerID);
}
if(this.isOther)
{
returnLayer = "null";
alert("Error:\nDue to your browser you will probably not\nbe able to view all of the following page\nas it was designed to be viewed. We regret\nthis error sincerely.");
}
return returnLayer;
}
// HideShow 1.0 Jim Cummins - http://www.conxiondesigns.com
ypSlideOutMenu.ShowL = function(ID)
{
ypSlideOutMenu.aLs(ID).visibility = "visible";
}
ypSlideOutMenu.HideL =function(ID)
{
ypSlideOutMenu.aLs(ID).visibility = "hidden";
}
ypSlideOutMenu.HideShow = function(ID)
{
if((ypSlideOutMenu.aLs(ID).visibility == "visible") || (ypSlideOutMenu.aLs(ID).visibility == ""))
{
ypSlideOutMenu.aLs(ID).visibility = "hidden";
}
else if(ypSlideOutMenu.aLs(ID).visibility == "hidden")
{
ypSlideOutMenu.aLs(ID).visibility = "visible";
}
}
ypSlideOutMenu.showMenu = function(id)
{
//temporarly hide all selectboxes to fix IE bug with z-index
if(document.all)
{
for (var i=0; i<document.all.length; i++) {
o = document.all(i)
if (o.type == 'select-one' || o.type == 'select-multiple') {
// todo: add check for select in div?
if (o.style) o.style.display = 'none';
}
}
}
ypSlideOutMenu.ShowL(id+'Container');
}
ypSlideOutMenu.hide = function(id)
{
ypSlideOutMenu.HideL(id+'Container');
//show all selectboxes again to fix IE bug with z-index
if(document.all)
{
for (var i=0; i<document.all.length; i++) {
o = document.all(i)
if (o.type == 'select-one' || o.type == 'select-multiple') {
// todo: add check for select in div?
if (o.style) o.style.display = 'inline';
}
}
}
}