PageSourceSearch

https://ds24.ru/bitrix/templates/ranx-landing/assets/js/headerfixed.js

js ds24.ru collected 2026-09-24 11:52:04 UTC 2,173 bytes, 70 lines download raw bytes

1
2// hiding/showing fixed header on scroll
3window.addEventListener('scroll', function() {
4    if (!document.getElementById('headerfixed')) {
5        return;
6    }
7    if (pageYOffset > 200) {
8        document.getElementById('headerfixed').style.top = 0;
9    } else {
10        document.getElementById('headerfixed').style.top = '-200px';
11    }
12
13    let centerYPosition = $(window).scrollTop() + Math.round($(window).height() / 2);
14
15    let slideToGo = null;
16    $('.anchors-list a').each(function(){
17        let link = $(this).attr('href');
18
19        if (!$(link).length) {
20            return;
21        }
22
23        if (parseInt($(link).offset().top) < centerYPosition) {
24            slideToGo = $(this).closest('.slick-slide').data('slick-index');
25        }
26    });
27
28    if (slideToGo) {
29        $('.anchors-list').slick('slickGoTo', slideToGo);
30    }
31});
32
33document.addEventListener('DOMContentLoaded', function(event) { 
34    // scroll to block on anchor clicking
35    let anchorsList = document.querySelectorAll('.anchors-list a');
36
37    for (let i = 0; i < anchorsList.length; i++) {
38        anchorsList[i].addEventListener('click', function(e){
39            e.preventDefault();
40
41            var $this = $(this);
42            let link = this.attributes.href.value;
43            //let offset = document.querySelector(link).getBoundingClientRect().top + pageYOffset;
44
45            if (link.length) {
46                $('html, body').animate({
47                    scrollTop: $(link).offset().top - $('#headerfixed').height()
48                }, 1000);
49                setTimeout(function(){
50                    $('.anchors-list').slick('slickGoTo', $this.closest('.slick-slide').data('slick-index'));
51                }, 1100);
52            }
53        });
54    }
55
56    // scroll to top, when double click on fixed header
57    $('#headerfixed').on('dblclick', function(){
58        $('html, body').animate({
59            scrollTop: 0
60        }, 500);
61    });
62
63    $('.anchors-list').slick({
64        variableWidth: true,
65        infinite: false,
66        prevArrow: '',
67        nextArrow: '',
68        centerMode: true
69    });
70});

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.