Glen Lipka schrieb:
> <http://glenlipka.kokopop.com/jQuery/tabs/#>
> 
> 
>      >>> I'm thinking about extending the callback system in the Tabs
>     plugin to
>      >>> not only allow one callback, but different ones for more
>     flexibility:
>      >>>
>      >
> 
> 
> 
> On My latest prototype using tabs: 
> http://glenlipka.kokopop.com/jQuery/tabs/# I want to actually run a 
> function when the user hits one particular tab.  I was going to use the 
> callback you have now, and stick an IF statement inside of it to check 
> if it's the right tab.
> 
> Would your suggestions here make that easier in the future?

I have now implemented the callbacks: there's an onClick, onHide, onShow 
callback to choose from. Please consider the documentation for more details.

Not sure if that makes your problem easier to solve. At least you are 
more flexible when to perform the check you nedd. If you have a 
reference to that particular tab, you could do a check like this:

$('...').tabs({
     onClick: function(clicked) {
         if (clicked == particularTab) {
             // do soemthing
         }
     }
});


> I also like the idea of pre-loading the tab content via load(), but I 
> worry about combining tabs with the history plugin.  Would anything 
> break?  Responsiveness and speed are paramount, especially if the tabs 
> have alot of stuff in them.

You know that I'm all for unobtrusiveness and accessibility, so I see no 
point in loading tabs content from a server. Don't do Ajax for the sake 
of Ajax.

But: If you combine the tabs plugin with the remote plugin I think you 
could make it degrade gracefully again (although I haven't tested it):

First build your menu with the links pointing to an URL where the 
content gets loaded from and add dummy tab content (ok that's not 
totally unobtrusive but let's be pragmatic for now):

<div id="container">
     <ul>
         <li><a href="load/content/from.php">First tab</a></li>
         <li><a href="load/content/from.php">First tab</a></li>
         <li><a href="load/content/from.php">First tab</a></li>
     </ul>
     <div id="remote-1"></div>
     <div id="remote-2"></div>
     <div id="remote-3"></div>
</div>

And then build your remote links and initialize tabs afterwards:

$('#container').find('a').remote().end().tabs();

remote() changes the anchors href attribute to "#remote-1" etc., so that 
the connection between anchor href and the id of the tab content is 
created, which is required for the tabs initialization.


Cheers, Klaus




-- 
Klaus

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to