About jScroll
jScroll is a jQuery plugin for infinite scrolling, written by Philip Klauzinski. Infinite scrolling; also known as lazy loading, endless scrolling, autopager, endless pages, etc.; is the ability to load content via AJAX within the current page or content area as you scroll down. The new content can be loaded automatically each time you scroll to the end of the existing content, or it can be triggered to load by clicking a navigation link at the end of the existing content.
An example of infinite scrolling is your Facebook "News Feed" page. You may notice that when you scroll to the bottom of this page, new content will often load automatically, or you will be given a link to "Older Posts" which will load more content when clicked.
Download Latest Version
The latest version of jScroll is available for download from GitHub.
Usage
The jscroll
method is called on the selector for which you want your scrollable content contained within. For example:
$('.infinite-scroll').jscroll();
The jscroll
method takes an optional object literal as a parameter for overriding the default options. An example of how this can be done is shown below.
$('.infinite-scroll').jscroll({ loadingHtml: '<img src="loading.gif" alt="Loading" /> Loading...', padding: 20, nextSelector: 'a.jscroll-next:last', contentSelector: 'li' });
Options
debug | false | When set to true, outputs useful information to the console display if theconsole object exists. |
autoTrigger | true | When set to true, triggers the loading of the next set of content automatically when the user scrolls to the bottom of the containing element. When set to false, the required next link will trigger the loading of the next set of content when clicked. |
autoTriggerUntil | false | Set to an integer great than 0 to turn offautoTrigger of paging after the specified number of pages. Requires autoTrigger to be true . |
loadingHtml | '<small>Loading...</small>' | The HTML to show at the bottom of the content while loading the next set. |
padding | 0 | The distance from the bottom of the scrollable content at which to trigger the loading of the next set of content. This only applies when autoTrigger is set to true. |
nextSelector | 'a:last' | The selector to use for finding the link which contains the href pointing to the next set of content. If this selector is not found, or if it does not contain a href attribute, jScroll will self-destroy and unbind from the element upon which it was called. |
contentSelector | '' | A convenience selector for loading only part of the content in the response for the next set of content. This selector will be ignored if left blank and will apply the entire response to the DOM. |
callback | false | Pass a function to this option and it will be called at the end of each page load. Alternatively, you can pass a function as the only argument to the jScroll instantiation instead of an options object, and it will be returned as a callback. |
For more information on the contentSelector option and how it loads a response fragment, see the jQuery documentation for the .load() method.
Example 1
For a real-world example of jScroll, visit Hang3 | Social Classifieds.
The following is an example of jScroll out of the box, using all default options.
The HTML (abbreviated)
<div class="scroll"> <h3>Page 1</h3> <p>Content here...</p> <a href="example-page2.html">next page</a> </div>
The JavaScript
$('.scroll').jscroll();
It's that easy!
Example 2 - Using autoTrigger = false
// Don't automatically load content on scroll, require user to click the link instead $('.scroll').jscroll({ autoTrigger: false });
Example 3 - Using autoTriggerUntil
// autoTrigger on scroll until after the third request is loaded $('.scroll').jscroll({ autoTriggerUntil: 3 });
相关推荐
jquery jscroll 滚动条 插件,可以自己定义滚动条样式
JScroll.js是JQeury的一个滚动条文件,我们不在使用老土的系统滚动条,跟QQ滚动条一样炫丽,可以用图片或CSS自由条件,附加Jquery.jscorll使用说明文档一份。
jquery jscroll
非常好用的基于jquery的滚动条插件jscroll_files , 可自定义滚动条样式
包含echarts.min.js, jquery.jscroll.min.js, jquery.min.js, jquery.SuperSlide.2.1.1.js, jquery-1.4.2.min.js, jquery-1.6.2.min.js, jquery-1.9.1.min.js, jquery-1.12.0.min.js ,jquery-2.2.3.min.js,jquery-...
从网上下载的jscroll.js源代码,发现当高度达到一定程度的时候,出现问题,修改之,存于此处
只需要2分,远离10分8分 含简单demo 另附插件名称: layer.m(弹窗) jquery.jscroll(滚动加载) 自己去网上下载
首先要引用两个脚本:jquery.js,jscroll.js; 接着为要出现滚动条的位置写上overflow:auto;这时会出现滚动条,最原始的样子。接着,加上以下脚本: 我的滚动条图片是这样的: 以下我借用高手的做法介绍下一些...
对jscroll.js修改改进后可动态重载滚动条,自定义滚条,在此记录~~
前端项目-jscroll,用于无限滚动/自动分页的jquery插件。
Jscroll 自定义滚动条
jScrollPane这个jQuery插件可以让你通过简单的CSS设置就能够替换所有分块元素在浏览器中默认的垂直滚动条样式。
jscroll_js实现QQ软件滚动条
主要介绍了jQuery实现的自定义滚动条,结合完整实例详细分析了jQuery自定义滚动条的实现步骤与相关操作技巧,并给出了jquery.jscroll.js插件的完整代码,需要的朋友可以参考下
asp.net 垂直滚动条Css样式,Js实现源码 包含文件: jquery.js jscroll.js scroll.jpg 源码.doc
我遇到的唯一问题是,当包含 jQuery Mobile 时,jscroll 在初始化时加载了多个页面。 鉴于此,以及我需要一个不固定的社交按钮页脚,版权等。 我创建了一个更简单的版本,当用户滚动到页脚的开头(或它上面的一些...
自定义滚动条 scroll js滚动条 jquery.js jscroll.js 修改图片就可以实现多种样式滚动条
jQuery多彩滚动条与动感的分割线二例源码,jscroll和spit_line,自定义分隔条,css分隔条,让分隔条也漂亮起来。 漂亮的滚动条,自定义滚动条,自定义滚动条样式,兼容firefox,谷歌。可以自由的给滚动条定义背景,上下...
里是自己在工作不太忙的时候写出来了一个用户可以自定义的滚动条jscroll,以下简称jscroll。jscroll默认只提供一种滚动条样式,部分样式来自google webstore ,其中有部分css3样式主要用于实现圆角,阴影效果