fix: The banner configuration is not enabled, resulting in console error (#293)
* fix: The banner configuration is not enabled, resulting in console errors * refactor: simplify banner visibility check and improve error handling in showBanner function --------- Co-authored-by: jump-and-jump <984292420@qq.com> Co-authored-by: L4Ph <4ranci0ne@gmail.com>
This commit is contained in:
parent
9a21c0e9e1
commit
8cceb83e81
1 changed files with 10 additions and 5 deletions
|
|
@ -208,7 +208,9 @@ import {
|
||||||
BANNER_HEIGHT,
|
BANNER_HEIGHT,
|
||||||
BANNER_HEIGHT_HOME,
|
BANNER_HEIGHT_HOME,
|
||||||
BANNER_HEIGHT_EXTEND,
|
BANNER_HEIGHT_EXTEND,
|
||||||
MAIN_PANEL_OVERLAPS_BANNER_HEIGHT} from "../constants/constants";
|
MAIN_PANEL_OVERLAPS_BANNER_HEIGHT
|
||||||
|
} from "../constants/constants";
|
||||||
|
import { siteConfig } from '../config';
|
||||||
|
|
||||||
/* Preload fonts */
|
/* Preload fonts */
|
||||||
// (async function() {
|
// (async function() {
|
||||||
|
|
@ -325,12 +327,15 @@ function initCustomScrollbar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function showBanner() {
|
function showBanner() {
|
||||||
const banner = document.getElementById('banner')
|
if (!siteConfig.banner.enable) return;
|
||||||
|
|
||||||
|
const banner = document.getElementById('banner');
|
||||||
if (!banner) {
|
if (!banner) {
|
||||||
console.error('Failed to find the banner element')
|
console.error('Banner element not found');
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
banner.classList.remove('opacity-0', 'scale-105')
|
|
||||||
|
banner.classList.remove('opacity-0', 'scale-105');
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue