PageSourceSearch

https://mdtel.de/js/vendor/jquery.sticky.js

js mdtel.de collected 2026-10-02 01:00:49 UTC 2,924 bytes, 106 lines download raw bytes

1(function ($) {
2	var f = {
3		topSpacing: 0,
4		bottomSpacing: 0,
5		className: 'is-sticky',
6		wrapperClassName: 'sticky-wrapper',
7		center: false,
8		getWidthFrom: ''
9	},
10	$window = $(window),
11	$document = $(document),
12	sticked = [],
13	windowHeight = $window.height(),
14	scroller = function () {
15		var a = $window.scrollTop(),
16		documentHeight = $document.height(),
17		dwh = documentHeight - windowHeight,
18		extra = (a > dwh) ? dwh - a: 0;
19		for (var i = 0; i < sticked.length; i++) {
20			var s = sticked[i],
21			elementTop = s.stickyWrapper.offset().top,
22			etse = elementTop - s.topSpacing - extra;
23			if (a <= etse) {
24				if (s.currentTop !== null) {
25					s.stickyElement.css('position', '').css('top', '');
26					s.stickyElement.parent().removeClass(s.className);
27					s.currentTop = null
28				}
29			} else {
30				var b = documentHeight - s.stickyElement.outerHeight() - s.topSpacing - s.bottomSpacing - a - extra;
31				if (b < 0) {
32					b = b + s.topSpacing
33				} else {
34					b = s.topSpacing
35				}
36				if (s.currentTop != b) {
37					s.stickyElement.css('position', 'fixed').css('top', b);
38					if (typeof s.getWidthFrom !== 'undefined') {
39						s.stickyElement.css('width', $(s.getWidthFrom).width())
40					}
41					s.stickyElement.parent().addClass(s.className);
42					s.currentTop = b
43				}
44			}
45		}
46	},
47	resizer = function () {
48		windowHeight = $window.height()
49	},
50	methods = {
51		init: function (e) {
52			var o = $.extend(f, e);
53			return this.each(function () {
54				var a = $(this);
55				var b = a.attr('id');
56				var c = $('<div></div>').attr('id', b + '-sticky-wrapper').addClass(o.wrapperClassName);
57				a.wrapAll(c);
58				if (o.center) {
59					a.parent().css({
60						width: a.outerWidth(),
61						marginLeft: "auto",
62						marginRight: "auto"
63					})
64				}
65				if (a.css("float") == "right") {
66					a.css({
67						"float": "none"
68					}).parent().css({
69						"float": "right"
70					})
71				}
72				var d = a.parent();
73				d.css('height', a.outerHeight());
74				sticked.push({
75					topSpacing: o.topSpacing,
76					bottomSpacing: o.bottomSpacing,
77					stickyElement: a,
78					currentTop: null,
79					stickyWrapper: d,
80					className: o.className,
81					getWidthFrom: o.getWidthFrom
82				})
83			})
84		},
85		update: scroller
86	};
87	if (window.addEventListener) {
88		window.addEventListener('scroll', scroller, false);
89		window.addEventListener('resize', resizer, false)
90	} else if (window.attachEvent) {
91		window.attachEvent('onscroll', scroller);
92		window.attachEvent('onresize', resizer)
93	}
94	$.fn.sticky = function (a) {
95		if (methods[a]) {
96			return methods[a].apply(this, Array.prototype.slice.call(arguments, 1))
97		} else if (typeof a === 'object' || !a) {
98			return methods.init.apply(this, arguments)
99		} else {
100			$.error('Method ' + a + ' does not exist on jQuery.sticky')
101		}
102	};
103	$(function () {
104		setTimeout(scroller, 0)
105	})
106})(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.