Friday, October 01, 2010

Fixed menu again

Although the fixed menu worked fine with IE7, Firefox and chrome, when IE 6 is used, the same age old problem of SELECT showing over DIV still exists when you scroll the window.

I have just noticed that when the web page is shown with the SELECT positioned just behind the DIV, it actually works. But when you scroll the SELECT again go on top of the DIV.

I have a stupid but working solution to this. Just do the following.

Create a javascript right at the end of the page which will only appears if the browser is IE 6 and below using the
<!--[if lte IE 6]>... <![endif]--> syntax to ensure that the script will not be used for IE7 and above.

Add the following in the script

mytime =setInterval("goforit()",100)
function goforit() {
hf=document.getElementById("hiframe")
hf.style.display="none";
hf.style.display=""

Finally add a IFRAME between the two DIV. with style similar to the second DIV. The SRC should be <html></html> but replace the greater than and lesser than with the escape code for the two character. The height and width should be same as the second div. Give it and ID (hiframe in the script example).

It will be good to hide the IFRAME if it is not IE 6 and below or other browsers.

No comments:

Post a Comment