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

H5 页面横向滚动条隐藏 #72

Open
liqinuo opened this issue Jan 3, 2018 · 0 comments
Open

H5 页面横向滚动条隐藏 #72

liqinuo opened this issue Jan 3, 2018 · 0 comments

Comments

@liqinuo
Copy link
Collaborator

liqinuo commented Jan 3, 2018

问题场景:微信 iOS 客户端 webview 下 H5 页面横向滚动条不隐藏

以往的做法

::webkit-scrollbar {
    display: none;
}

但是

微信 webview 内核由 UIWebView 升级到新内核 WKWebView 后,就不生效了

问题分析:只要添加了 -webkit-overflow-scrolling: touch 平滑滚动属性,隐藏滚动条样式就会失效。

新的思路

把滚动条撑开,然后通过负值的外边距抵消撑开的部分,使得外容器高度不受影响,从而大道滚动条溢出隐藏

<div class="slider">
    <ul></ul>
</div>
.slider {
    overflow: hidden;
}
.slider ul {
    padding-bottom: 10px;
    margin-bottom: -10px;
}
@liqinuo liqinuo changed the title H5 页面滚动条隐藏 H5 页面横向滚动条隐藏 Jan 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant