PageSourceSearch

https://lands.go.tz/site/js/custom.js

js lands.go.tz collected 2026-10-02 17:06:49 UTC 1,732 bytes, 55 lines download raw bytes

1
2
3///parallax effect on bg
4const main_banners = document.querySelectorAll(".parallax-banner");
5var banners_offsets = [];
6var banners_rates = [];
7
8if(main_banners.length){ 
9  main_banners.forEach((banner,index) => {
10    banners_offsets.push(0);
11    banners_rates.push(0.5);
12    bannerPosition = banner.getBoundingClientRect().top+scrollTop
13    if(banner.dataset.offset) banners_offsets[index] = parseInt(banner.dataset.offset);
14    if(banner.dataset.rate) banners_rates[index] = parseFloat(banner.dataset.rate);
15    if ($( window ).width() > 991.98) banner.style.backgroundPosition="0px " + (-1*(banners_offsets[index]))+"px";
16    else  banner.style.backgroundPosition="0px 0px";
17  });
18}
19
20$('body').scroll(function(e){
21    //  add fixed header when scroll
22    var scrollTop = $('body').scrollTop();
23    if(scrollTop > 180){
24        $('.top-bottom').addClass('fixed-top');
25    } else {
26        $('.top-bottom').removeClass('fixed-top');
27    }
28
29    scrollBanner();
30});
31
32
33
34$(window).resize(function(e){
35    scrollBanner();
36    hasReset = false;
37});
38
39  var hasReset = false;
40  var scrollTop = 0;
41  function scrollBanner(){
42    if(hasReset && window.innerWidth < 991.98) return
43    scrollTop = $('body').scrollTop();
44    
45    if(main_banners.length  ){
46        main_banners.forEach((banner,index) => {
47            bannerPosition = banner.getBoundingClientRect().top+scrollTop;
48            if (window.innerWidth > 991.98)  banner.style.backgroundPosition="0px " + (scrollTop*banners_rates[index]-(banners_offsets[index]))+"px";
49            else  {
50                banner.style.backgroundPosition="0px 0px";    
51                hasReset = true;
52            }    
53        });
54    }
55  }

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.