News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

modifying the shrink/expand header script of smf

Started by 061, July 26, 2005, 09:37:45 AM

Previous topic - Next topic

061

how can i modify the shrink/expand header java script so that i can use it for controlling a second table on my forum.

the changes i wish to have are
1- the table is collapsed initially and expand on click
2- the table collapse/expand state is reset to collapsed on every page i.e forum dont memorize the state
3- this functioning along side the original expand/collapse header.

script is
<script language="JavaScript" type="text/javascript"><!-- // --><!

[CDATA[
var current_header = ', empty($options['collapse_header']) ? 'false' :

'true', ';

function shrinkHeader(mode)
{';

// Guests don't have theme options!!
if ($context['user']['is_guest'])
echo '
document.cookie = "upshrink=" + (mode ? 1 : 0);';
else
echo '
smf_setThemeOption("collapse_header", mode ? 1 : 0);';

echo '
document.getElementById("upshrink").src = smf_images_url +

(mode ? "/upshrink2.gif" : "/upshrink.gif");

document.getElementById("upshrinkHeader").style.display = mode

? "none" : "";

current_header = mode;
}
// ]]></script>


and the image controlling

<a href="#" onclick="shrinkHeader(!current_header); return false;"><img id="upshrink" src="', $settings['images_url'], '/', empty($options['collapse_header']) ? 'upshrink.gif' : 'upshrink2.gif', '" alt="*" title="', $txt['upshrink_description'], '" style="margin: 2px 2ex 2px 0;" border="0" /></a>';




if u ppl can help with this i be grateful
thanks

061

well I managed to work out the rest of this except that the table remains expand at all times. how to set that to collapsed State by default.

[Unknown]

There are lots of topics about this; search for upshrink.

-[Unknown]

Advertisement: