Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Tabs from a Blurbs Widget
<widget type="blurbs">
<arg id="type">...</arg>
<arg id="group">...</arg>
<arg id="format"><div class="lw_blurbs_title">{title}</div><div class="lw_blurbs_body">{body}</div></arg>
<arg id="class">tabbed</arg>
</widget>
/* must override LiveWhale's default clearing of <li>s in widgets */
.lw_widget .ui-tabs-nav li {
clear: none !important;
}
function tabify() {
$('.lw_widget_blurbs.tabbed > ul').each(function(index) {
var tabMenu = $('<ul></ul>');
$(this).find('.lw_blurbs_title').each(function() {
var tabName = $(this).html().toLowerCase().replace(/[^a-z]+/g,'')+'-tabset'+index;
$(this).hide().parent('li').attr('id',tabName);
tabMenu.append('<li><a href="#'+tabName+'">'+$(this).html()+'</a></li>');
});
$(this).parent('.tabbed').prepend(tabMenu).tabs();
});
}
$(document).ready(function() {
tabify();
});

mckelvey commented Sep 6, 2012

Great Job @jonwilcox! Be sure and tell @whitewhale about this.

Owner

jonwilcox commented Sep 13, 2012

Changed js so that tab id is added to the parent

  • instead of .lw_blurbs_body to fix an issue in IE7 where the
  • s didn't collapse even when all contents were hidden.

  • Owner

    jonwilcox commented Sep 13, 2012

    Correction: Changed js so that tab id is added to the parent

  • instead of .lw_blurbs_body to fix an issue in IE7 where the
  • s didn't collapse even when all contents were hidden.

  • Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment