PageSourceSearch

https://whizfordacademy.com/wp-content/themes/educatex/assets/js/jquery.scrollUp.js?ver=3.2.4

js whizfordacademy.com collected 2026-10-04 15:49:06 UTC 5,338 bytes, 162 lines download raw bytes

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

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.