/******************************************************************* * * File : JSFX_FloatingLayer.js © JavaScript-FX.com * * Created : 2001/03/16 * * Author : Roy Whittle www.Roy.Whittle.com * * Purpose : To make and positional div float to * one plave on the page and stay there. * * History * Date Version Description * * 2001-03-17 2.0 Converted for javascript-fx ***********************************************************************/ JSFX.FloatingLayer = function(theDiv, x, y, bdy_height) { //Call the superclass constructor this.superC = JSFX.Layer; this.superC(JSFX.findLayer(theDiv), x, y, bdy_height); this.bdy_height = bdy_height; this.theDiv = theDiv this.baseX = x; this.baseY = y; this.x = x; this.y = y; this.moveTo(x,y); this.show(); } JSFX.FloatingLayer.prototype = new JSFX.Layer; JSFX.FloatingLayer.prototype.animate = function() { var targetX; var targetY; var cell; var boxheight; if (document.getElementById) { cell = document.getElementById(this.theDiv); } else if (document.all) { cell = document.all[this.theDiv]; } if (cell) { boxheight = cell.offsetHeight; //alert(cell.offsetHeight); } if(this.baseX > 0) targetX = JSFX.Browser.getMinX() + this.baseX; else targetX = JSFX.Browser.getMaxX() + this.baseX; if(this.baseY > 0) targetY = JSFX.Browser.getMinY() + this.baseY; else targetY = JSFX.Browser.getMaxY() + this.baseY; var dx = (targetX - this.x)/8; var dy = (targetY - this.y)/8; this.x += dx; this.y += dy; var left_offset = (alertSize()-800)/2 + 40; if (left_offset<78) { left_offset=78; } this.baseX = left_offset; //this.moveTo(this.x, this.y); lowesty = boxheight + this.y + 20; if (this.bdy_height > lowesty) { this.moveTo(this.baseX, this.y); } if (this.bdy_height <= lowesty) { this.style.left = this.baseX+"px"; //this.moveTo(this.baseX, lowesty); } } JSFX.MakeFloatingLayer = function(theDiv, x, y, bdy_height) { JSFX.MakeFloatingLayer.floaters[JSFX.MakeFloatingLayer.floaters.length] = new JSFX.FloatingLayer(theDiv, x, y, bdy_height); } JSFX.MakeFloatingLayer.floaters = new Array(); JSFX.MakeFloatingLayer.animate = function() { var i; for(i=0 ; i