Skip to content

aienkel/jquery.scrollLoading

 
 

Repository files navigation

This is a scroll loading plugin which can load more contents from ajax continuously while scrolling.
1. "init" function parameters:
    appendTo: the new contents will append to which dom.
    judgeBy: judge by which dom's height to load new contents while scrolling.
    ajaxData: parameters of the function "$.ajax". "html" and "json" are supported with "dataType".
    ratio: (optional) execute the next loading when the ratio of "scroll top" to "content height" exceed this value.
2. If json is used, just set the new contents as the value of "content" key, for example: {"content": "<span>Ground Control To Major Tom</span>", "error": "false"}.
3. If replacing request parameters is needed for continuous loading, please overwrite the property "$.scrollLoading.ajaxData.data" in your callback function.

可連續自動加載的捲軸
1. init 參數說明:
    appendTo: 要 append 內容的 dom
    judgeBy: 依據哪個 dom 的高度判斷是否加載
    ajaxData: $.ajax 的參數,dataType 目前支援 html, json
    ratio: (optional) 捲軸高度/內容高度的值大於多少時才加載,預設為 0.9
2. 若要使用 json 格式,請將新內容放入 content 索引中,即:{content: [新內容], xxx: 123, ...}
3. 若有連續加載的動作需要重設 request 參數,請覆寫 $.scrollLoading.ajaxData.data = {...}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published