Pages

Monday, May 6, 2013

6

Small update (visual improvement) for my tabbed gadgets

I made my gadget tabifying widget back in 2011. Today I saw another implementation, and it had nice fade in effect. I remembered that I had used also jQuery in the tabifying widget, and that jQuery has nice functions for fading. So I decided to try and tweak it a little. The result can be seen on this blog: click on the tabs on right sidebar (for example, About me, Followers, Subscribe to) and notice the smooth transition. :)

(This won't work with nested tabs, but I don't recommend using them in the first place, because nested tabs can be confusing to user.)

If you have my tabbed gadgets hack installed, you can make the same changes. It is quite easy:

1. Open the tabifying gadget for editing. Make a backup of the working script before making changes.

2. Find line (near line 105):
  for(var i = 0; i<tabnav0_tabids.length; i++) {
3. after that add this line:
    if(tabnav0_tabids[i] == nimi) continue;
If you have multiple tab sets, and you have tabnav1_tabids instead of tabnav0_tabids, use tabnav1_tabids in the added line, etc.

4. Then find this block of code (near line 111):
  toshow = document.getElementById(tabnav3_id).style.display;
  document.getElementById(nimi).style.display=toshow;
  if(tabsIDs[nimi])
    document.getElementById(tabsIDs[nimi]).style.display = toshow;
5. Replace that block of code with this:
  $("#"+nimi).fadeIn(300);
  if(tabsIDs[nimi])
    $("#"+tabsIDs[nimi]).fadeIn(300);
6. Save the gadget.

If you want, you can adjust the fade in time, now 300 (milliseconds), I think 200 to 600 milliseconds is good range. Hope you like it! :)
See the hack
for this dynamic
views icon: