public
Created

jQuery UI Tabs Test

  • Download Gist
jquery-ui-tabs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
<?php
if(isset($_GET['q']))
die($_GET['q']);
?>
<html>
<head>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" media="all" />
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js'></script>
</head>
<body>
<div id="tabs">
<ul>
</ul>
</div>
<script>
function init_tabs(){
if(jQuery.ui && jQuery.ui.tabs){
var tabAjaxOpts = {
type:'post',
success:function(){alert('onSuccess');},
error:function(){alert('onFail');},
cache: true
};
tabs_obj = jQuery("#tabs").tabs({
ajaxOptions: tabAjaxOpts,
cache: true,
load: function () {
alert('loaded');
}
});
}
}
jQuery(document).ready( function() {
init_tabs();
var tabs = ['Tab One', 'Tab Two', 'Tab Three'];
for(i in tabs){
var content = 'Content for: ' + tabs[i];
var url = 'index.php?q=' + content;
tabs_obj.tabs( "add" , url , tabs[i] );
}
});
</script>
</body>
</html>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.