下面是我一直在努力工作的一段代码。继续和上一个按钮不起作用,javascript 没有显示下一个和上一个选项卡。
Javascript:
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript">
$('.prev').click(function () {
;
var prevId = $(this).parents('.tab-pane').prev().attr("id");
$('[href=#' + prevId + ']').tab('show');
return false;
});
$('.next').click(function () {
var nextId = $(this).parents('.tab-pane').next().attr("id");
$('[href=#' + nextId + ']').tab('show');
return false;
});
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
//update progress
var step = $(e.target).data('step');
var percent = (parseInt(step) / 6) * 100;
$('.progress-bar').css({ width: percent + '%' });
$('.progress-bar').text("Step " + step + " of 6");
//e.relatedTarget // previous tab
})
$('.first').click(function () {
$('#myWizard a:first').tab('show');
})
</script>
html:
<div class="navbar">
<div class="navbar-inner">
<ul id="tabs1" class="nav nav-pills">
<li class="active"><a href="#step1" data-toggle="tab" data-step="1">Basic Details</a></li>
<li><a href="#step2" data-toggle="tab" data-step="2">Data Source</a></li>
<li><a href="#step3" data-toggle="tab" data-step="3">Feature Generation</a></li>
<li><a href="#step4" data-toggle="tab" data-step="4">Aggregation over Time</a></li>
<li><a href="#step5" data-toggle="tab" data-step="5">Analysis</a></li>
<li><a href="#step6" data-toggle="tab" data-step="6">Output</a></li>
</ul>
</div>