Skip to content

Instantly share code, notes, and snippets.

@emayk
Created April 2, 2012 04:08
Show Gist options
  • Select an option

  • Save emayk/2280638 to your computer and use it in GitHub Desktop.

Select an option

Save emayk/2280638 to your computer and use it in GitHub Desktop.
jquery : sample load jquery ui with partial content
$('#tabs').tabs({
select: function(event, ui) {
var $tabAnchor = $(ui.tab);
if (ui.index == 0 && !$tabAnchor.data('completed')) {
$($tabAnchor.attr('href')).load($tabAnchor.data('content-url'), function() {
// indicate the content has been loaded
$tabAnchor.data('completed', true);
});
}
}
});
<div id="tabs">
<ul>
<li><a href="#tabs1" data-content-url="/page #content">Tab Head</a></li>
<li><a href="#tabs2">Tab 2</a></li>
</ul>
<div id="tabs1"></div>
<div id="tabs2">...</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment