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

要进行x轴方向上的滚动该怎么配置? #30

Closed
xwpongithub opened this issue Feb 24, 2017 · 5 comments
Closed

要进行x轴方向上的滚动该怎么配置? #30

xwpongithub opened this issue Feb 24, 2017 · 5 comments

Comments

@xwpongithub
Copy link

image
我x像这样配置后发现不会滚动了,如果去掉则只是竖直方向上能正常滚动。

@xwpongithub
Copy link
Author

我发现问题了,是因为包裹他的父元素宽度不够大,所以造成了横向不能滚动。我用js算了一个宽度赋值给包裹元素就好了。。。有什么办法能让包裹元素随着子元素的宽度变化而变化吗,我发现用css的width:auto也无效。

@neurotoxinvx
Copy link
Contributor

betterscroll 可以 scroll 的前提是 外层 wrap 的宽(高) 固定,内层 inner 的宽(高) 大于容器。
inner 的宽(高)不一定需要通过 JS 赋值,但是请确保在创建 betterscroll 的时候,inner 的容器是被撑开且大于 wrap 的

@ustbhuangyi
Copy link
Owner

如果外层元素随着子元素的宽度而撑开,就不会有滚动的效果了,之所以有滚动是因为内层元素的宽(高)度大于外层容器。

@xwpongithub
Copy link
Author

哦哦,明白啦,谢谢老师~

@JerryWang24
Copy link

现在很多需求都是内容不定宽的,希望能支持!jquery-custom-content-scroller这个插件是支持的,不过需要jq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants