...

View Full Version : Expanding/Collapsing Menus in NS6



bassleader
06-21-2002, 07:31 PM
Hi guys,

I've written an expanding and collapsing navigation menu for my website. I'm using <div>s for the submenus and changing the style.visibility and style.display properties to show and hide them. The problem I have is the different behaviour between browsers. It works OK in MSIE but in NS6 when you hide the submenu it leaves a huge gap where the menu was, rather than realigning the menu. You can see what I mean here (http://homepage.ntlworld.com/huw.pierce/ntlspace/index.html). I think the problem could be something to do with Netscape's treatment of tables, but I'm not sure how to change it. If you have any suggestions I'd be very pleased to hear them.

Cheers.

Roy Sinclair
06-21-2002, 10:21 PM
I was going to try and help you but your browser detection code totally misses when I tried it with the Mozilla browser (Netscape 6+ is just a cheap knock-off). You need to refine your detection code to accept any Gecko based browser and not just Netscape branded versions.

bassleader
06-24-2002, 06:04 PM
Thanks Roy, I have amended my browser detection script and downloaded Mozilla. The realignment problem doesn't occur in Mozilla, so should I assume that this is a problem with NS (I am using v6.1)? If you're still interested I'd really appreciate your thoughts.

BL

jkd
06-24-2002, 06:30 PM
NS6.1 is based on an older version of Mozilla, which means more bugs were still unfixed.

This is true for all version of NS, even NS7 PR, which is based on Moz 0.99 (?), and the current official release is Moz 1.0, and you can grab Moz 1.1 Alpha if you please too.

Roy Sinclair
06-24-2002, 09:32 PM
Originally posted by bassleader
Thanks Roy, I have amended my browser detection script and downloaded Mozilla. The realignment problem doesn't occur in Mozilla, so should I assume that this is a problem with NS (I am using v6.1)? If you're still interested I'd really appreciate your thoughts.

BL

Take a look at the release notes for Mozilla, they may tell you about a positioning bug in earlier versions that they fixed which may give you a clue about what you can do to fix it in the Netscape 6x browsers. Netscape 7 should be based on Mozilla 1.0 so how long you'll need a fix really depends on how long it takes to get the majority of users to move away from those "beta browser as a released version" Netscape 6x browsers.

Graeme Hackston
06-24-2002, 11:50 PM
This works in NN6.2.1 on Win98.

<html>
<head>
<title>Expand</title>
<script language="JavaScript" type="text/javascript">
<!-- Hide script from older browsers

function toggle(Sub) {
if (document.getElementById) {
thisMenu = document.getElementById(Sub).style
if (thisMenu.display == "block") {
thisMenu.display = "none"
}
else {
thisMenu.display = "block"
}
return false
}
else {
return true
}
}

// End hiding script -->
</script>

<style>
.Subs {display: none;}
</style>

</head>
<body>

<a href="page.html" onClick="return toggle('Sub1')">Heading 1</a><br>
<span class="Subs" ID="Sub1">
content
</span>
<a href="javascript:void(0);" onClick="return toggle('Sub2')">Heading 2</a><br>
<span class="Subs" ID="Sub2">
content
</span>
<a href="#" onClick="return toggle('Sub3')">Heading 3</a>
<span class="Subs" ID="Sub3">
content
</span>
</body>
</html>

</edit>I had an open tag<edit>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum