mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-24 09:28:42 +00:00
fix: prevent scrolling when switching between tabs
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
40ebdae256
commit
c5129082b7
@ -580,10 +580,18 @@ if (UOJContest::cur()) {
|
||||
|
||||
// Change hash for page-reload
|
||||
$('.nav-pills a').on('shown.bs.tab', function(e) {
|
||||
var hash = e.target.hash;
|
||||
|
||||
if (e.target.hash == '#statement') {
|
||||
window.location.hash = '';
|
||||
hash = '#';
|
||||
}
|
||||
|
||||
if (window.history.pushState) {
|
||||
// Update the address bar
|
||||
window.history.pushState({}, '', hash);
|
||||
} else {
|
||||
window.location.hash = e.target.hash;
|
||||
// Fallback for the old browsers which do not have `history.pushState()`
|
||||
window.location.hash = hash;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -1340,21 +1340,6 @@ if ($cur_tab == 'index') {
|
||||
</div>
|
||||
</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>
|
||||
<?php elseif ($cur_tab == 'users') : ?>
|
||||
<div class="card mt-3 mt-md-0">
|
||||
<div class="card-header">
|
||||
@ -1791,7 +1776,13 @@ EOD;
|
||||
|
||||
// Change hash for page-reload
|
||||
$('.nav-tabs a').on('shown.bs.tab', function(e) {
|
||||
window.location.hash = e.target.hash;
|
||||
if (window.history.pushState) {
|
||||
// Update the address bar
|
||||
window.history.pushState({}, '', e.target.hash);
|
||||
} else {
|
||||
// Fallback for the old browsers which do not have `history.pushState()`
|
||||
window.location.hash = e.target.hash;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -47,7 +47,13 @@ $(document).ready(function() {
|
||||
|
||||
// Change hash for page-reload
|
||||
$('.nav-tabs a').on('shown.bs.tab', function(e) {
|
||||
window.location.hash = e.target.hash;
|
||||
if (window.history.pushState) {
|
||||
// Update the address bar
|
||||
window.history.pushState({}, '', e.target.hash);
|
||||
} else {
|
||||
// Fallback for the old browsers which do not have `history.pushState()`
|
||||
window.location.hash = e.target.hash;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user