Skip to content

Instantly share code, notes, and snippets.

@jonwilcox
Last active October 8, 2015 23:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonwilcox/3406739 to your computer and use it in GitHub Desktop.
Save jonwilcox/3406739 to your computer and use it in GitHub Desktop.
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
Copy link

mckelvey commented Sep 6, 2012

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

@jonwilcox
Copy link
Author

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.

  • @jonwilcox
    Copy link
    Author

    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