Ask questions and get good answers on mb.jQuery.components

First of all, I really like your mbContainerPlus plug-in, very elegantly done.

I am still trying to get my head around not only jQuery, but also your mbContainerPlus, so I am pretty much a newbie in this area.

I am trying to design a page which has two, (maybe three) containers, of which, I wish only one to be open at any given time. What I have so far is this: Containers are Iconized to a dock when pages loads, everything works fine when opening / iconizing / closing.

What I would like to do is iconize an open container when a docked container is toggled. I can think of the logic to check the states of the containers and iconize if open, but, I am unsure how to write the code or where to put it in the script.

Any help will greatly appreciated, Ian.

Merry Christmas too all, and Happy New Year :-)

asked Dec 25 '10 at 10:35

Ian%20A's gravatar image

Ian A
11

closed Feb 11 '11 at 15:51

Matteo%20Bicocchi's gravatar image

Matteo Bicocchi ♦♦
1776129

The question has been closed for the following reason "The question is answered, right answer was accepted" by Matteo Bicocchi Feb 11 '11 at 15:51


i think you need a onBeforeRestore-Callback to iconize the open container before the new one open

first add the option (all in mbContainer.js)

  this.options = {
    ...
    onBeforeRestore: function(o){},
    onRestore:function(o){},
    ...

then insert the callback

  this.dockIcon= ....
          .bind("click",function(){
    if (opt.onBeforeRestore) opt.onBeforeRestore(container);

then insert the function in your code

  function before_restore(o){
    // iconize the proper container
  }

  $(".containerPlus").buildContainers({
    ...
    onRestore:function(o){restore(o)},
    onBeforeRestore:function(o){before_restore(o)},

or wait until Matteo puts this in a future release ;)

hope that helps Abu

answered Jan 23 '11 at 13:36

Abu's gravatar image

Abu
711

Hello,

Thanks for your reply, as a side note, I seem to have forgotten my password, so am using a temporary log in.

JavaScript is not my strong suit, so I am trying what you mentioned, without success - probably due to my lack of understanding of how the code was written and implementation.

I will keep having a go, but at this stage, no luck for me.

Thanks for your help.

Ian.

answered Jan 29 '11 at 06:24

Ian%20A's gravatar image

Ian A
11

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×4
×3
×1
×1

Asked: Dec 25 '10 at 10:35

Seen: 437 times

Last updated: Feb 11 '11 at 15:51

jQuery main site - Matteo Bicocchi