Click to See Complete Forum and Search --> : Layer appearence in opera and netscape


nisgar2k
07-09-2003, 11:05 AM
Please can someone help with a problem i have related to layering in netscape and opera.

My web page has an iframe with a menu consisting of one layer on the left hand side. The z index of the layer is 1 and the layer is activated once the user hovers over a hyperlink to the left of it. Making it appear like a menu. I also use a positioning script to ensure that the layer is in the correct location each time the window is resized.

My first problem is that this layer when activated and made visible appears below my iframe instead of on top of it NOTE this only occurs in Opera its fine in IE and NS.

My second problem is that in NS when the resizing event and my script executes it makes my layer representing the sub menu of my menu appear squashed see the attached image u can see that the correct size of the submenu is greater than that visible.

The following code is used for the menu: -

/* Set of functions that handle the operation of a menu consisting of 2 layers
* Written by Nicholas Ford nisgar2k@hotmail.com
*/


/* Browser type and menu timer variables */
var isNetscape = (navigator.appName == "Netscape");
var timer;


/* This gets the layer object passed according to browser type */
function getObj(obj) {
if(isNetscape) {
retLayer = document.getElementById(obj).style;
//retLayer = document.layers[obj];
}else {
retLayer = eval("document.all." + obj + ".style");
}
return retLayer;
}


/* Makes the passed layer visible */
function show(layer) {
obj = getObj(layer);
obj.visibility = "visible";
}


/* Hides the passed layer */
function hide(layer) {
obj = getObj(layer);
obj.visibility = "hidden";
}


/* Find the availble width of the browser content window */
function getScreenWidth() {
available = (isNetscape) ? window.innerWidth : document.body.clientWidth;
return available;
}


/* Show or hide the submenu according to true or false passed */
function menuRoll(status) {
if (status) {
show("submenu0");
}else {
hide("submenu0");
}
}


/* Reposition the submenu on the page according to the size of the window */
function repositionMenu() {
obj = getObj("submenu0");
curW = getScreenWidth();

if(curW > 800) {
/*Half the browser width finds the centre of the page - half the page layout + the offset*/
newL = (curW/2 - 360) + 140;
obj.left = newL+"px";
}else {
obj.left = 150+"px";
}
}

Thanks for any help

Nick Ford

Khalid Ali
07-09-2003, 11:28 AM
Originally posted by nisgar2k

My first problem is that this layer when activated and made visible appears below my iframe instead of on top of it NOTE this only occurs in Opera its fine in IE and NS.
Nick Ford

Se this for your first problem
http://www.webreference.com/programming/javascript/form/
Originally posted by nisgar2k


My second problem is that in NS when the resizing event and my script executes it makes my layer representing the sub menu of my menu appear squashed
Nick Ford

for the second part I think you only need to play around with this part

newL = (curW/2 - 360) + 140;

I'll see if later on I can work on it myself