PageSourceSearch

https://textileheritagemuseum.org/wp-content/themes/arcane/js/scrollup.js?ver=2.4.0

js textileheritagemuseum.org collected 2026-10-02 12:13:45 UTC 6,047 bytes, 196 lines download raw bytes

vendor: 4,683 bytes, lines 1-146
1/*!
2 * scrollup v2.4.0
3 * Url: http://markgoodyear.com/labs/scrollup/
4 * Copyright (c) Mark Goodyear  @markgdyr  http://markgoodyear.com
5 * License: MIT
6 */
7
8(function ($, window, document) {
9    'use strict';
10
11    // Main function
12    $.fn.scrollUp = function (options) {
13
14        // Ensure that only one scrollUp exists
15        if (!$.data(document.body, 'scrollUp')) {
16            $.data(document.body, 'scrollUp', true);
17            $.fn.scrollUp.init(options);
18        }
19    };
20
21    // Init
22    $.fn.scrollUp.init = function (options) {
23
24        // Define vars
25        var o = $.fn.scrollUp.settings = $.extend({}, $.fn.scrollUp.defaults, options),
26            triggerVisible = false,
27            animIn, animOut, animSpeed, scrollDis, scrollEvent, scrollTarget, $self;
28
29        // Create element
30        if (o.scrollTrigger) {
31            $self = $(o.scrollTrigger);
32        } else {
33            $self = $('<a/>', {
34                id: o.scrollName,
35                href: '#top'
36            });
37        }
38
39        // Set scrollTitle if there is one
40        if (o.scrollTitle) {
41            $self.attr('title', o.scrollTitle);
42        }
43
44        $self.appendTo('body');
45
46        // If not using an image display text
47        if (!(o.scrollImg || o.scrollTrigger)) {
48            $self.html(o.scrollText);
49        }
50
51        // Minimum CSS to make the magic happen
52        $self.css({
53            display: 'none',
54            position: 'fixed',
55            zIndex: o.zIndex
56        });
57
58        // Active point overlay
59        if (o.activeOverlay) {
60            $('<div/>', {
61                id: o.scrollName + '-active'
62            }).css({
63                position: 'absolute',
64                'top': o.scrollDistance + 'px',
65                width: '100%',
66                borderTop: '1px dotted' + o.activeOverlay,
67                zIndex: o.zIndex
68            }).appendTo('body');
69        }
70
71        // Switch animation type
72        switch (o.animation) {
73            case 'fade':
74                animIn = 'fadeIn';
75                animOut = 'fadeOut';
76                animSpeed = o.animationSpeed;
77                break;
78
79            case 'slide':
80                animIn = 'slideDown';
81                animOut = 'slideUp';
82                animSpeed = o.animationSpeed;
83                break;
84
85            default:
86                animIn = 'show';
87                animOut = 'hide';
88                animSpeed = 0;
89        }
90
91        // If from top or bottom
92        if (o.scrollFrom === 'top') {
93            scrollDis = o.scrollDistance;
94        } else {
95            scrollDis = $(document).height() - $(window).height() - o.scrollDistance;
96        }
97
98        // Scroll function
99        scrollEvent = $(window).scroll(function () {
100            if ($(window).scrollTop() > scrollDis) {
101                if (!triggerVisible) {
102                    $self[animIn](animSpeed);
103                    triggerVisible = true;
104                }
105            } else {
106                if (triggerVisible) {
107                    $self[animOut](animSpeed);
108                    triggerVisible = false;
109                }
110            }
111        });
112
113        if (o.scrollTarget) {
114            if (typeof o.scrollTarget === 'number') {
115                scrollTarget = o.scrollTarget;
116            } else if (typeof o.scrollTarget === 'string') {
117                scrollTarget = Math.floor($(o.scrollTarget).offset().top);
118            }
119        } else {
120            scrollTarget = 0;
121        }
122
123        // To the top
124        $self.click(function (e) {
125            e.preventDefault();
126
127            $('html, body').animate({
128                scrollTop: scrollTarget
129            }, o.scrollSpeed, o.easingType);
130        });
131    };
132
133    // Defaults
134    $.fn.scrollUp.defaults = {
135        scrollName: 'scrollUp',      // Element ID
136        scrollDistance: 300,         // Distance from top/bottom before showing element (px)
137        scrollFrom: 'top',           // 'top' or 'bottom'
138        scrollSpeed: 300,            // Speed back to top (ms)
139        easingType: 'linear',        // Scroll to top easing (see http://easings.net/)
140        animation: 'fade',           // Fade, slide, none
141        animationSpeed: 200,         // Animation in speed (ms)
142        scrollTrigger: false,        // Set a custom triggering element. Can be an HTML string or jQuery object
143        scrollTarget: false,         // Set a custom target element for scrolling to. Can be element or number
144        scrollText: 'Scroll to top', // Text for element, can contain HTML
145        scrollTitle: false,          // Set a custom <a> title if required. Defaults to scrollText
146        scrollImg: false,            // Set true to use image
147        activeOverlay: false,        // Set CSS color to display scrollUp active point, e.g '#00FFFF'
148        zIndex: 2147483647           // Z-Index for the overlay
149    };
150
151    // Destroy scrollUp plugin and clean all modifications to the DOM
152    $.fn.scrollUp.destroy = function (scrollEvent) {
153        $.removeData(document.body, 'scrollUp');
154        $('#' + $.fn.scrollUp.settings.scrollName).remove();
155        $('#' + $.fn.scrollUp.settings.scrollName + '-active').remove();
156
157        // If 1.7 or above use the new .off()
158        if ($.fn.jquery.split('.')[1] >= 7) {
159            $(window).off('scroll', scrollEvent);
160
161        // Else use the old .unbind()
162        } else {
163            $(window).unbind('scroll', scrollEvent);
164        }
165    };
166
167    $.scrollUp = $.fn.scrollUp;
168
169})(jQuery, window, document);
170
171/*!
172 * ScrollUp Handlers for back to top
173 *
174 * Copyright (c) 2013-2015 DesignOrbital.com
175 * License: GNU General Public License v2 or later
176 * http://www.gnu.org/licenses/gpl-2.0.html
177 */
178
179( function( $ ) {
180
181	// Document Ready
182	$( document ).ready( function() {
183
184		// Scroll Up
185		$.scrollUp({
186            scrollDistance: 1000,
187            scrollFrom:     'bottom',
188            scrollSpeed:    1500,
189            animation:      'slide',
190            scrollText:     '<span></span>',
191            zIndex:         99950
192        });
193
194	} );
195
196} )( 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.