PageSourceSearch

https://adraalbania.org/wp-content/themes/blankslate/js/viewport.js

js adraalbania.org collected 2026-10-02 22:31:21 UTC 2,787 bytes, 89 lines download raw bytes

1/*
2 * Viewport - jQuery selectors for finding elements in viewport
3 *
4 * Copyright (c) 2008-2009 Mika Tuupola
5 *
6 * Licensed under the MIT license:
7 *   http://www.opensource.org/licenses/mit-license.php
8 *
9 * Project home:
10 *  http://www.appelsiini.net/projects/viewport
11 *
12 */
13(function($) {
14    
15    $.belowthefold = function(element, settings) {
16        var fold = $(window).height() + $(window).scrollTop();
17        return fold <= $(element).offset().top - settings.threshold;
18    };
19
20    $.abovethetop = function(element, settings) {
21        var top = $(window).scrollTop();
22        return top >= $(element).offset().top + $(element).height() - settings.threshold;
23    };
24    
25    $.rightofscreen = function(element, settings) {
26        var fold = $(window).width() + $(window).scrollLeft();
27        return fold <= $(element).offset().left - settings.threshold;
28    };
29    
30    $.leftofscreen = function(element, settings) {
31        var left = $(window).scrollLeft();
32        return left >= $(element).offset().left + $(element).width() - settings.threshold;
33    };
34    
35    $.inviewport = function(element, settings) {
36        return !$.rightofscreen(element, settings) && !$.leftofscreen(element, settings) && !$.belowthefold(element, settings) && !$.abovethetop(element, settings);
37    };
38    
39    $.extend($.expr[':'], {
40        "below-the-fold": function(a, i, m) {
41            return $.belowthefold(a, {threshold : 0});
42        },
43        "above-the-top": function(a, i, m) {
44            return $.abovethetop(a, {threshold : 0});
45        },
46        "left-of-screen": function(a, i, m) {
47            return $.leftofscreen(a, {threshold : 0});
48        },
49        "right-of-screen": function(a, i, m) {
50            return $.rightofscreen(a, {threshold : 0});
51        },
52        "in-viewport": function(a, i, m) {
53            return $.inviewport(a, {threshold : 0});
54        }
55    });
56
57    
58})(jQuery);
59    
60    $(window).bind("scroll", function(event) {
61        $(".coins:in-viewport").each(function() {
62            $(".circ").addClass("active");
63        });
64        $(".impact-area-links:in-viewport").each(function() {
65            $(".impact-area-links li").addClass("show");
66        });
67
68        /*  Reveal Next & Previous Icons */
69
70
71            $(".page-header h1:above-the-top").each(function() {
72                $("footer:below-the-fold").each(function() {
73                    $(".next-post, .prev-post").addClass("show");
74                });
75            });
76
77            $(".page-header h1:in-viewport").each(function() {
78                $(".next-post, .prev-post").removeClass("show");
79            });
80
81            $("footer:in-viewport").each(function() {
82                $(".next-post, .prev-post").stop().removeClass("show");
83            });
84
85            
86    });
87
88
89

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.