I noticed on the original version of the iTheme the side-bar blocks are collapsible when the user click the green "glass orb" in the top-right corner of each block. I'm sure this is easily done with jQuery and the addition of a nice effect like slide-up. If I have some extra time I'll work on implementing this.

Comments

eferraiuolo’s picture

I was able to get this functionality working on a test site; it simply toggles the content of a block when clicking it's title. For this to become a useful feature it should remembers each user's setting (hide or show) for each block. The only way I see this being a possibility is for each block to have some sort of unique ID. Any suggestions?

eferraiuolo’s picture

StatusFileSize
new106.88 KB

This is a better implemtation and adding the JS files the "correct" way via the template.php file. See the attached file.

From my demo site:
I've modified the iTheme to work closer to the original, this theme currently has the added features of:

  • Ability to collapse and open blocks by clicking their title.
  • A slide up/down animation when a block is changing state to collapsed or open.
  • Retaining each user's setting (open or collapsed) for each [unique] block through all the pages of the site for the user's current browser session (until they close their browser).

To accomplish this functionality:

  • I've added a template.php file to the theme which load some javascript:
    • The jQuery Cookie [helper] plugin
    • An inline variable to set the cookies' path to the site's base_path()
    • The jQuery code I wrote that implements everything

Test it out for yourself! And report back any bugs or oddities.

Also note that it will degrade gracefully for people with javascript off.

Attached below is a copy of the modified version of the iTheme

eferraiuolo’s picture

Status: Active » Closed (fixed)

Added to first official release.

tknospdr’s picture

Status: Closed (fixed) » Active

I really like this theme, the site I'm doing right now won't look anything like what it's starting out as but I'm still using your theme as a base.

My quick question is, when I log in the default state of the blocks is 'closed' how do I get them to default to 'open'?

My test site - http://www.technospider.com/~david/drupal5

Thanks,
David
http://www.FloridaPets.org

eferraiuolo’s picture

This shouldn't be the case, as the code uses cookies to determine if a block should be collapsed. With that, the only way a cookie is created is when the block is open and the title is clicked.

Try deleting your cookies, and refresh the page. If that doesn't work it might be something interfering with the prototype JS library; I would recommend using Drupal's Thickbox to replace the lightbox plugin. This will greatly reduce the amount and number of JS files loaded on your site. Right now you have to JS libraries loaded, prototype with spritalious and jquery!

tknospdr’s picture

Status: Active » Closed (fixed)

Okay, killing the cookies fixed it. Thanks.

I went with Lightbox over Thickbox because the loading animation for Thickbox is messed up in Firefox on the Mac.

Thanks,
David
http://www.FloridaPets.org

siaiweb’s picture

Well, i'm a complete noob in Jscript: can anyone help me there? I would like to make all my blocks collapsed by default but one. Is there an esay way to get this done???
Thanks

And thank you for those great improvements made to itheme!! I just wish i could make it liquid...

sudomaster’s picture

StatusFileSize
new30.18 KB

I would also like to know how to have the blocks collapsed by default. For someone visiting the page, it looks cleaner (to me).

On another note, I have found itheme's width to be easily adjusted - liquid would be nice (I like 90% or 80%) but most screen resolutions are set above 800x600 so I've set my site to have a width of 800px. Change the wrapper section as follows:

#wrapper {

width: 800px;

margin: 0px auto;

position: relative;

}

I haven't played with the idea of making it fluid yet... but perhaps later.

After changing the wrapper width, you then need to change the width of the main content:

/* ------------------------------------- main content area */

#left-col {

width: 575px;

float: right;

margin-top: 11px;

}

and then the "left"/"right" sidebar:

/* ------------------------------------- sidebar area */

/* sidebar */

#sidebar {

float:left;

width: 210px;

color: #666666;

line-height: 160%;

}

You also need to change the appropriate images for the theme (i.e. content-bottom-bg.gif, content-top-bg.gif, sidep-handle.gif). I have to apologize - I may have made some other small changes, but didn't document them! This should get you started, though...

sudomaster