PageSourceSearch

https://oms.sav.sk/wp-content/themes/akademia/js/scrollbar-fixed.js

js sav.sk collected 2026-09-24 08:44:25 UTC 2,326 bytes, 84 lines download raw bytes

1/**
2 * Akademia theme JS for fixed scrollbar.
3 *
4 * @package WordPress
5 * @subpackage Akademia
6 * @since Akademia 3.0.0
7 */
8
9$( function($){
10    var scrollbar = $('<div id="fixed-scrollbar"><div></div></div>').appendTo($(document.body));
11    scrollbar.css({
12        display: 'none',
13        width: '100%',
14        height: '20px',
15        position: 'fixed',
16        bottom: 0,
17        overflowX: 'auto'
18    });
19    var fakecontent = scrollbar.find('div');
20    
21    function top(e) {
22        return e.offset().top;
23    }
24
25    function bottom(e) {
26        return e.offset().top + e.height();
27    }
28    
29    var active = $([]);
30    function find_active() {
31        scrollbar.css({display:'block'});
32        var active = $([]);
33        $('.fixed-scrollbar').each(function() {
34            if (top($(this)) < top(scrollbar) && bottom($(this)) > bottom(scrollbar)) {
35                fakecontent.width($(this).get(0).scrollWidth);
36                fakecontent.height(1);
37                active = $(this);
38            }
39        });
40        fit(active);
41        return active;
42    }
43    
44    function fit(active) {
45        if (!active.length) return scrollbar.css({display:'none'});
46        scrollbar.css({left: active.offset().left, width:active.width()});
47        fakecontent.width($(this).get(0).scrollWidth);
48        fakecontent.height(1);
49        delete lastScroll;
50    }
51    
52    function onscroll(){
53        var oldactive = active;
54        active = find_active();
55        if (oldactive.not(active).length) {
56            oldactive.unbind('scroll', update);
57        }
58        if (active.not(oldactive).length) {
59            active.scroll(update);
60        }
61        update();
62    }
63    
64    var lastScroll;
65    function scroll() {
66        if (!active.length) return;
67        if (scrollbar.scrollLeft() === lastScroll) return;
68        lastScroll = scrollbar.scrollLeft();
69        active.scrollLeft(lastScroll);
70    }
71    
72    function update() {
73        if (!active.length) return;
74        if (active.scrollLeft() === lastScroll) return;
75        lastScroll = active.scrollLeft();
76        scrollbar.scrollLeft(lastScroll);
77    }
78    
79    scrollbar.scroll(scroll);
80    
81    onscroll();
82    $(window).scroll(onscroll);
83    $(window).resize(onscroll);
84} );

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.