Last active
October 8, 2015 23:48
-
-
Save jonwilcox/3406739 to your computer and use it in GitHub Desktop.
Tabs from a Blurbs Widget
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* must override LiveWhale's default clearing of <li>s in widgets */ | |
.lw_widget .ui-tabs-nav li { | |
clear: none !important; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
}); |
Changed js so that tab id is added to the parent
Correction: Changed js so that tab id is added to the parent
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great Job @jonwilcox! Be sure and tell @whitewhale about this.