feat(web/contest/backstage): hash route for tabs
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-10-22 11:55:39 +08:00 committed by GitHub
parent bae26f1c16
commit 6ef2c2c119
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,3 +35,19 @@
<?php endif ?>
</div>
</div>
<script>
$(document).ready(function() {
// Javascript to enable link to tab
var hash = location.hash.replace(/^#/, '');
if (hash) {
bootstrap.Tab.jQueryInterface.call($('.nav-tabs a[href="#' + hash + '"]'), 'show').blur();
}
// Change hash for page-reload
$('.nav-tabs a').on('shown.bs.tab', function(e) {
window.location.hash = e.target.hash;
});
});
</script>