publik-website/static/js/combo.public.js

71 lines
2.6 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

$(function() {
$('.bistro').parallax("0%", 0.2);
$('.bistro > div').parallax("2%", 1.2);
$('a[href^="#"]').on('click',
function() { $.scrollTo($(this).attr('href'), 1000); }
);
if ($('.textcell.tablette').length) {
setInterval(function() {
var $clock = $('.mobile-case .clock');
var date = new Date();
$clock.text(('0' + date.getHours()).slice(-2) + ':' + ('0' + date.getMinutes()).slice(-2));
}, 500);
}
$('.textcell.tablette img').each(function(idx, elem) {
var $cell = $(elem).parents('div.textcell');
var $mobile_case = $('<div class="mobile-case">' +
'<div class="screen">' +
'<div class="mobile-top-bar"><span class="clock">--:--</span></div>' +
'<div class="mobile-app-content">' +
'</div>' +
'</div>' +
'</div>');
$mobile_case.find('.mobile-app-content').append($(elem).detach());
$cell.append($mobile_case);
});
if ($('.ecrans').length > 0) {
var $window = $(window);
var offset = parseInt(Math.random()*2000);
var $ecrans = $('.ecrans');
$window.bind('scroll', function() {
var pos = Math.pow($window.scrollTop(), 1.1);
$ecrans.css('background-position', (offset + pos) + 'px 0px');
});
$window.trigger('scroll');
}
if ($('div[id|=chiffres]').length) {
var $chiffres_section = $('div[id|=chiffres]');
$chiffres_section.css('position', 'relative');
var total = $chiffres_section.attr('id').split('-')[1];
var $counter = $('<span id="counter"></span>').appendTo($chiffres_section.find('> div'));
var options = {
useEasing : true,
useGrouping : true,
separator : '',
prefix : '',
suffix : ' demandes'
};
function get_current_count() { // (saas only)
var base_number = 2370000;
var base_date = new Date("2020-12-31T00:00:00");
var diff = (Date.now() - base_date.getTime()) / 1000;
/* approx rate on base date: 1 request every 26 seconds
* December 1st: 2250000, December 31st: 2380000
* 1 / ((2380000 - 2250000) / (86400seconds * 31days)) -> 20
*/
return base_number + (diff / 20);
}
//var count = new CountUp("counter", 1234, parseInt(total), 0, 4.5, options);
var count = new CountUp("counter", 1, parseInt(get_current_count()), 0, 4.5, options);
$chiffres_section.on('inview', function() {
count.start();
});
setInterval(function() {
count.update(get_current_count());
}, 2000);
}
});