It would be great to hide the complete region instead of opening/closing each block. For some site configurations the left or right regions are only helpers for the site navigation, and sometimes disabling them should give more space for the content reading.

I'm not sure about the implications, as the configuration should allow to enable or disable the hide/show option for each region, but the option would give a usability helper for the users.

Thanks in advance!

Comments

surajhs’s picture

This code is to expand/collapse submenu in left panel in My Projects section.

Book.module from line 655

function book_tree_recurse($nid, $depth, $children, $unfold = array()) {
global $divheight;
$output = '';
if ($depth > 0) {
if (isset($children[$nid])) {
foreach ($children[$nid] as $foo => $node) {
$divheight = $divheight + 1;
$linktitle = array();
$showhide = array("onClick" => "showHideCat(expand'.$node->nid.')");
if (in_array($node->nid, $unfold)) {
if ($tree = book_tree_recurse($node->nid, $depth - 1, $children, $unfold)) {
$linktitle['title'] = '?q=node/'. $node->nid;
$output .= '

  • '; // function showHideCat(el) { if (el != null) { el.style.display=(el.style.display=="none")?"":"none"; } }

    $output .= l($node->title, 'node/'. $node->nid, $linktitle);
    $output .= 'nid . '\');" >Only local images are allowed.

    nid.' style="display:block">

    ';
    $output .= '

  • ';

    }
    else {
    $linktitle['title'] = '?q=node/'. $node->nid;
    $output .= '

  • '. l($node->title, 'node/'. $node->nid, $linktitle) .'
  • ';
    }
    }
    else {
    if ($tree = book_tree_recurse($node->nid, 1, $children)) {
    $linktitle['title'] = '?q=node/'. $node->nid;
    $output .= '

    ';
    }
    else {
    $linktitle['title'] = '?q=node/'. $node->nid;
    $output .= '

  • '.l($node->title, 'node/'. $node->nid, $linktitle).'
  • ';
    }
    }
    }
    }
    }

    return $output;
    }

    ----------------------------------------------------------------------

    Add expand.js in modules/jquery_update/expand.js

    function showHideCat(el)
    {
    if (el != null)
    {
    el.style.display=(el.style.display=='none')?'':'none'
    }
    }

    Hope this helps