I love this widget in google closure, Zippy and I need an equevalent in jquery. I'm pretty sure there is one. I found Accordion in jquery UI, but it is not the same behaviour. Unlike Accordion, which organizes a set of chunks and shows only one at a time, Zippy targets one chunk and toggles its visibility.
You can easily make your own plugin for such a simple task :
(function($) {
$.fn.zippy = function(options) {
var o = $.extend({}, options, $.fn.zippy.defaults);
return this.each(function(i,el) {
var $el = $(el),
content = $el.find('p'),
title = $el.find('h2');
title.toggle(function() {
content.slideToggle(o.duration, o.easing, o.callback);
});
});
};
$.fn.zippy.defaults = {
easing : 'swing',
duration : 500,
callback : function(){}
};
})(jQuery)