1
0
mirror of https://github.com/TeamNewPipe/website synced 2025-10-06 16:33:25 +02:00
Files
website/js/parallax_donate.js
TobiGr 1b5c1305bd Update donation page
Remove Bitcoin and Bountysource.
2023-09-02 11:20:10 +02:00

44 lines
1.4 KiB
JavaScript

/* TODO: replace that shit with CSS */
let featuresHeight, featuresPosition, windowHeight;
function parallax_reset() {
windowHeight = $(window).height();
featuresHeight = $('#donate-wrapper').outerHeight(true);
featuresPosition = $('#donate-wrapper').position().top;
$('#parallax-background').css('height', featuresHeight + 'px');
}
function parallax() {
const scrolled = $(window).scrollTop();
//console.log(featuresHeight + " " + featuresPosition + " " + bitcoinHeight + " " + windowHeight + " " + scrolled + " " + (featuresHeight - scrolled + featuresPosition));
if ($(document).height() <= $(window).height()) {
$('#parallax-background').css('height', (featuresHeight + featuresPosition - scrolled) + 'px');
} else {
$('#parallax-background').css('height', (featuresHeight + featuresPosition + windowHeight - scrolled) + 'px');
}
//$('.phone-background').css('top', featuresPosition + bitcoinHeight + featuresHeight/2 - scrolled*0.9 + 'px');
}
$(window).scroll(function(e) {
if ($(window).width() > 767){
parallax();
}
});
$(window).resize(function(e) {
parallax_reset();
parallax();
/*if($(window).width() < 767){
$('.phone-background img').hide();
}
else {
$('.phone-background img').show();
}*/
});
$(window).on("load", function() {
parallax_reset();
parallax();
//if($(window).width() > 767) $('.phone-background img').show();
});