Javascript collapsing view [message #24135] |
Sat, 16 April 2005 18:56 |
StingRay
Messages: 14 Registered: April 2005
Karma: 0
|
Junior Member |
|
|
Did a search and didn't see this, so forgive if already discussed and dismissed.
The ability to collapse categories etc is great, but if possible I'd like to see the option to have this done via javascript so the page does not need to reload after expanding or collapsing.
More and more the benefits of mixing this kind of navigation are being used, just look at Google leading the way with their maps.
Here's an example to clarify what I mean.
<script language='JavaScript' type='text/javascript'>
function ShowHide(id1, id2) {
if (id1 != '') expMenu(id1);
if (id2 != '') expMenu(id2);
}
function expMenu(id) {
var itm = null;
if (document.getElementById) {
itm = document.getElementById(id);
} else if (document.all){
itm = document.all[id];
} else if (document.layers){
itm = document.layers[id];
}
if (!itm) {
// do nothing
}
else if (itm.style) {
if (itm.style.display == 'none') { itm.style.display = ''; }
else { itm.style.display = 'none'; }
}
else { itm.visibility = 'show'; }
}
</script>
And usage
<a href="javascript:ShowHide('qr_open','qr_closed');" title='Contact us'>Contact Us</a>
<div id='qr_open'>
<span style='position: absolute;top: 390px;left: 110px;'>
<table border="0"style="width:40%" cellspacing="2" cellpadding="0">
<tr>
<td>
<form action="/scripts/index.php" method="post" class="listitem">
Name: <input type="text" name="name" value=""><br /><br />
Email : <input type="text" name="email" value=""><br /><br />
Message:<br />
<textarea rows="2" cols="40" name="message"></textarea><br />
<input type="submit" name="submit" value="Submit">
<input type="hidden" name="sent" value="yes">
<input type="hidden" name="action" value="check">
</form>
</td>
</tr>
</table>
</span>
</div>
|
|
|
Re: Javascript collapsing view [message #24154 is a reply to message #24135] |
Sun, 17 April 2005 16:14 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
Well it's a bit of a trade off, the main page of the forum could have dosens of categories and as many as hundreds of forum (most of which would of course be collapsed). By loading this data all the time to permit change of state via JavaScript would increase the loading times of the page due to the increased page size. This would not be a welcome thing for users on slower connections.
BTW did you test your code on all modern browsers (IE, Mozilla, Safari/Konqueror, Opera) ?
FUDforum Core Developer
|
|
|
|
Re: Javascript collapsing view [message #24166 is a reply to message #24157] |
Mon, 18 April 2005 03:06 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
Unless it can be confirmed that it will work on all modern browsers including this a moot point.
FUDforum Core Developer
|
|
|