Coder Social home page Coder Social logo

bibumimu / loadonscroll Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ictliujie/loadonscroll

0.0 2.0 0.0 144 KB

页面滚动时动态加载数据 load data dynamically when you scroll the page

License: MIT License

JavaScript 61.94% HTML 38.06%

loadonscroll's Introduction

loadOnScroll

loadOnScroll组件,用于在页面或者元素滚动时动态加载数据,支持垂直滚动和水平滚动。

构造属性:

element: document.body,  //可以自动伸缩的元素

container: window,  //默认的容器

vertical: true, //是否垂直方向滚动,否则是水平滚动

threshold: 200,  //加载的阈值,即滚动至离底部或右侧多大距离时加载

loadTimes: "infinite", // 加载的次数,可以无限次(默认),或者固定的次数

onload: function(o){} //加载的主体函数,可以是普通函数或者是ajax请求

公共方法:

options:修改默认属性的方法,用户可以在使用过程中,修改上面某个(些)属性,参数是对象,key-value格式

refresh:刷新组件,只要是对子元素大小,加载状态等的更新,这个是作为用户自定义函数的必须的回调

stop: 停止组件,去除事件绑定

Example:

var los = new loadOnScroll({
		loadTimes: 2,
		onload: function(o){
			$("#itemList").append('<div class="item"></div><div class="item"></div>');
			los.refresh();
		}
	});
	更多可以参见test.html

loadonscroll's People

Contributors

ictliujie avatar

Watchers

James Cloos avatar  avatar

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.