Giter Club home page Giter Club logo

waterfall-layout's Introduction

瀑布流式布局 (Waterfall Layout)

介绍

什么是瀑布流布局?直接到 Pinterest 的网站上体验一下就知道了。

image

说明

正好由于工作需要,花了点时间总结了两种方式的瀑布流布局:一种基于 inline-boxflex,对浏览器兼容有一定要求;另一种方式与 Pinterest 采用的方式相同,即使用 absolute 方式。

  • 基于 inline-box + flex 性能较好,但需要浏览器兼容 flex;
  • 基于 absolute 性能较差。由于 absolute 的特性,需要在窗口变化时不停的重绘页面;

这两种方式实现的瀑布流式布局均支持首屏和网页窗口大小改变时的列数自适应。

实现

这里实现的流式布局假设首屏内容是通过异步加载获取的。如需将首屏内容直接渲染输出,需要对渲染部分的逻辑稍作修改。

waterfall-layout's People

Contributors

becavalier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

tpanhh

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.