Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

siteConfig.banner.enable设置为true,刷新页面会出现原生滚动条闪烁 #60

Closed
lengyuekongliu opened this issue Apr 22, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@lengyuekongliu
Copy link

设置首页banner后,第二次刷新页面,由于图片已经被缓存,图片先于initCustomScrollbar加载出来了,所以会出现一下原生滚动条然后被OverlayScrollbars的样式覆盖。

目前我的解决办法是给banner加上出现过渡动画,暂时解决了

@saicaca saicaca added the bug Something isn't working label Apr 22, 2024
@CosmoLau
Copy link

CosmoLau commented Sep 13, 2024

@saicaca 按照楼主的方法,给 Banner 加上过渡动画确实能解决这个问题,即修改这行代码

<ImageWrapper id="banner" alt="Banner image of the blog" class:list={["object-cover h-full transition duration-700"]}

在样式中添加 onload-animation,修改如下:

		<GlobalStyles>
		{siteConfig.banner.enable && <div id="banner-wrapper" class="absolute -top-[30vh] w-full transition duration-700 overflow-hidden">
-			<ImageWrapper id="banner" alt="Banner image of the blog" class:list={["object-cover h-full transition duration-700"]}
+			<ImageWrapper id="banner" alt="Banner image of the blog" class:list={["object-cover h-full transition duration-700 onload-animation"]}
					  src={siteConfig.banner.src} position={siteConfig.banner.position}
			>
			</ImageWrapper>
		</div>}
		<slot />
		</GlobalStyles>

请问一直没修复这个问题,是还有别的考量吗?如果不修复这个问题,只要在启用 Banner 时对任何页面进行刷新,页面都会出现闪烁的情况。

貌似和这个是同一个问题 #138

@saicaca
Copy link
Owner

saicaca commented Sep 19, 2024

请问一直没修复这个问题,是还有别的考量吗?如果不修复这个问题,只要在启用 Banner 时对任何页面进行刷新,页面都会出现闪烁的情况。

没有,只是没想起来修这个。官方文档给的解决方法是给 htmlbody 元素加上 data-overlayscrollbars-initialize 属性, 8565724 已修复。

给 banner 加动画看起来确实也能解决这个问题和 #138 ,但我还没搞明白为什么

@saicaca saicaca closed this as completed Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants