Avoid preview-image delaying the switching of the top bar title (mobile views)

Use Intersection Observer API to optimize the performance of title switching
This commit is contained in:
Cotes Chung
2022-01-06 17:42:08 +08:00
parent e7b377cf63
commit 837d0778b6
7 changed files with 46 additions and 30 deletions

View File

@@ -4,6 +4,7 @@
$(function() {
const $topbarWrapper = $("#topbar-wrapper");
const $topbarTitle = $("#topbar-title");
const $panel = $("#panel-wrapper");
const $searchInput = $("#search-input");
@@ -54,7 +55,7 @@ $(function() {
}
$(window).scroll(function(event) {
if ($("#topbar-title").is(":hidden")) {
if ($topbarTitle.is(":hidden")) {
didScroll = true;
}
});