From: David H. <dav...@ho...> - 2001-02-11 19:52:48
|
I have been trying to make a Layer that would resize as the browser window resizes... I tried something like this without much luck: DynAPI.onLoad = function() { var pad = 10; myLayer = new DynLayer(); myLayer.setSize(DynAPI.document.getWidth()-(pad*2),DynAPI.document.getHeight ()-(pad*2)); myLayer.setBgColor('#c0c0c0'); myLayer.moveTo(pad,pad); rszLstn=new EventListener(myLayer); rszLstn.onresize=function(e) { target = e.getTarget(); target.setSize(target.parent.getWidth()-(pad*2),target.parent.getHeight()-(p ad*2)); } DynAPI.document.addEventListener(rszLstn); DynAPI.document.addChild(myLayer); } It didn't seem that there was a resize event in the document... I took a look at the resizeHandler and also the loadHandler and noticed the load handler was invoking a beforeload, load, and afterload event. I borrowed the event code from the loadHandler and add this line to the resizeHandler: if (DynAPI.document.invokeEvent) DynAPI.document.invokeEvent('resize'); ...and my code worked like I expected it to. I have two questions. 1) What would be the "normal" way of doing this without modifying the DynAPI. 2) Should the resize event be added to the resize handler for convenience and consistency. Thanks Dave Holbrook dav...@ho... |