3
and there is what I managed to use myself
It helps some blocks not to be annoying. U can check at
http://somsa.ktusa.lt/xoops/ (click block Titles :)
theme.html: in column template code I put sth like this
<{foreach item=block from=$xoops_lblocks}> <span style="cursor:hand; cursor: pointer;" onclick="toggle('<{$block.title}>');" >
<!-- cursor style : IE - hand, Mozilla - pointer -->
<div class="blockTitle"><{$block.title}></div></span>
<div id="<{$block.title}>" class="blockContent"><{$block.content}></div>
<{/foreach}>
Block template Edit: to hide block content initially
<div id="Recent Topics_inside" style="display:none">
template code...
</div>
well, here things depend on "Block Title", so they are kind of hardCoded :\, bul efect is worth it :).
js could be included directly in
xoops.js or after it in
theme.html file.
<script type="text/javascript">
<!--
<{$xoops_js}>
//-->
</script>
<script type="text/javascript">
<!--
// toggle visibility sinchronizing 2 nested divs
// in my case all blocks are visible by default
// _inside block gives ability to make a blok invisible through "Templates management"
function toggle( targetId ){
target = xoopsGetElementById( targetId );
target2 = xoopsGetElementById( ''+ targetId + '_inside' );
var base_display_property;
if (target2) { base_display_property = target2.style.display;} // if some value is forced through templates
else { base_display_property = target.style.display;};
if ( target.style.display == 'none')
base_display_property = 'none'; // outer div
if (target) // I could check it earlier ;)
{if ( base_display_property == "none"){
target.style.display = "block";
if (target2) target2.style.display = "block";
} else {
target.style.display = "none";
if (target2) target2.style.display = "none";
}
}
}
-->
</script>
would be useful some cookie or other session stuff to remember, whicth blocks (contents) (in)visible
some other block-dynamics examples:
http://www.dynamicdrive.com/dynamicindex17/agallery.htmhttp://simon.incutio.com/code/js/easytoggle/example2.htmlhttp://www.dyn-web.com/dhtml/slide/slide-onclick.html