PageSourceSearch

https://www.jmd.co.jp/libs/js/jquery.bottom-1.0.js

js jmd.co.jp collected 2026-10-02 04:27:02 UTC 1,059 bytes, 43 lines download raw bytes

1/**
2 * jQuery.bottom
3 * Dual licensed under MIT and GPL.
4 * Date: 2010-04-25
5 *
6 * @description Trigger the bottom event when the user has scrolled to the bottom of an element
7 * @author Jim Yi
8 * @version 1.0
9 *
10 * @id jQuery.fn.bottom
11 * @param {Object} settings Hash of settings.
12 * @return {jQuery} Returns the same jQuery object for chaining.
13 *
14 */
15(function($){
16	$.fn.bottom = function(options) {
17
18		var defaults = {
19			// how close to the scrollbar is to the bottom before triggering the event
20			proximity: 0
21		};
22
23		var options = $.extend(defaults, options);
24
25		return this.each(function() {
26			var obj = this;
27			$(obj).bind("scroll", function() {
28				if (obj == window) {
29					scrollHeight = $(document).height();
30				}
31				else {
32					scrollHeight = $(obj)[0].scrollHeight;
33				}
34				scrollPosition = $(obj).height() + $(obj).scrollTop();
35				if ( (scrollHeight - scrollPosition) / scrollHeight <= options.proximity) {
36					$(obj).trigger("bottom");
37				}
38			});
39
40			return false;
41		});
42	};
43})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.