PageSourceSearch

https://www.oreshura.net/common/js/jquery.smoothScroller.js

js oreshura.net collected 2026-10-02 14:39:39 UTC 2,168 bytes, 75 lines download raw bytes

1;(function($) {�
2	var name_space = 'smoothScroller';�
3�
4	$.fn[name_space] = function(options) {�
5		var defaults = {�
6			fps: 60,�
7			speed:0.1�
8		}�
9		var s = $.extend(defaults, options);�
10		var scrollTimer;�
11		var obj;�
12�
13		return this.each(function(i){�
14			if(isPositionFixedSupported()) {�
15				obj = $(this);�
16				obj.parent().prepend('<div id="smoothScroller_page_height"></div>');�
17				obj.wrap('<div id="smoothScroller_page_wrap"></div>');�
18				obj = $("#smoothScroller_page_wrap");�
19				obj.css({�
20					position: "fixed",�
21					top: "0px",�
22					width: "100%"�
23				});�
24				$("#smoothScroller_page_height").height(obj.outerHeight(true));�
25				scrollSmooth();�
26				$(window).scroll(function(e) {�
27					scrollSmooth();�
28				});�
29				�
30				setInterval(function() {�
31					$("#smoothScroller_page_height").height(obj.outerHeight(true));�
32				},500);�
33			}�
34		});�
35�
36		function scrollSmooth() {�
37			if(scrollTimer) clearInterval(scrollTimer);�
38			var t = $(window).scrollTop();�
39			var p = obj.css("top").replace("px", "") * 1;�
40			var v = (t*-1 - p);�
41			var m = p + v * s.speed;�
42�
43			obj.css("top",m*1);�
44			if(Math.abs(v) < 1){�
45				obj.css("top",t*-1);�
46			}else{�
47				scrollTimer = setInterval(scrollSmooth,1000/s.fps);�
48			}�
49		}�
50�
51		function isPositionFixedSupported() {�
52			var container = document.body;�
53			if (document.createElement &&�
54				container && container.appendChild && container.removeChild) {�
55				var el = document.createElement("div");�
56				if (!el.getBoundingClientRect) {�
57				    return null;�
58				}�
59				el.innerHTML = "x";�
60				el.style.cssText = "position:fixed;top:100px;";�
61				container.appendChild(el);�
62				var originalHeight = container.style.height, originalScrollTop = container.scrollTop;�
63				container.style.height = "3000px";�
64				container.scrollTop = 500;�
65				var elementTop = el.getBoundingClientRect().top;�
66				container.style.height = originalHeight;�
67				var isSupported = elementTop === 100;�
68				container.removeChild(el);�
69				container.scrollTop = originalScrollTop;�
70				return isSupported;�
71			}�
72			return null;�
73		}�
74	};�
75})(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.