Giter VIP home page Giter VIP logo

Comments (8)

zxc23 avatar zxc23 commented on May 17, 2024 1

I achieved this quite simply by using flexbox. Parent style:

.parent {
  display: flex;
}

and a class for the virtual scroller:

.list {
  flex: 1;
}

Just need to set :remain generously.

from vue-virtual-scroll-list.

tangbc avatar tangbc commented on May 17, 2024

Generally speaking, this component only support fixed height for scroll offset calculation.

But there is a way by changing remain and size to stretch dynamic height.

from vue-virtual-scroll-list.

ocassio avatar ocassio commented on May 17, 2024

Hmm... Not the most convenient solution, but it works.
Thanks for your help!

from vue-virtual-scroll-list.

rijkvanzanten avatar rijkvanzanten commented on May 17, 2024

But there is a way by changing remain and size to stretch dynamic height.

@tangbc Do you have an example of this way of achieving this? I've tried reading the window's height programmatically and substracting the right values based on it's surrounding elements, but that's far from ideal nor does it work properly.. 😞

from vue-virtual-scroll-list.

ocassio avatar ocassio commented on May 17, 2024

@rijkvanzanten, here is a very simple unoptimized example: https://codesandbox.io/s/lyv8pqyl69.
Maybe @tangbc can provide a better solution, though.

from vue-virtual-scroll-list.

rijkvanzanten avatar rijkvanzanten commented on May 17, 2024

Ahhhhhh you use the parents height instead of the window. That makes way more sense. Thanks 🙂

I think this would be a very nice addition to have in the plugin by default if that's possible somehow. Either way, this works for me 🎉

from vue-virtual-scroll-list.

zxc23 avatar zxc23 commented on May 17, 2024

My above solution doesn't work well when trying to implement a custom scrollbar.

The problem is that Remain must be set, yet a very common use case involves using the parent's height because of responsive layouts.

from vue-virtual-scroll-list.

slidenerd avatar slidenerd commented on May 17, 2024

@ocassio your items are fixed height, what if each item has a different size, what is remain and size then?

from vue-virtual-scroll-list.

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.