Giter Site home page Giter Site logo

Comments (5)

xwpongithub avatar xwpongithub commented on May 12, 2024

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

from better-scroll.

neurotoxinvx avatar neurotoxinvx commented on May 12, 2024

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

from better-scroll.

ustbhuangyi avatar ustbhuangyi commented on May 12, 2024

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

from better-scroll.

xwpongithub avatar xwpongithub commented on May 12, 2024

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

from better-scroll.

JerryWang24 avatar JerryWang24 commented on May 12, 2024

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

from better-scroll.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.