-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.js
55 lines (41 loc) · 1.54 KB
/
home.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
console.log("--- home.js / counter ...")
if ( !window.projectCountP ){
const projectCountP = fetch('https://solidata-api.co-demos.com/api/dsi/infos/get_one/5c7f0438328ed72e431f338e')
.then(r => r.json())
.then(r => r.data.data_raw.f_data_count);
const DELAY = 5000;
const counter = document.querySelector('.counter')
console.log("--- counter : ", counter)
projectCountP.then(projectCount => {
const start = performance.now();
(function step(){
requestAnimationFrame(now => {
const elapsed = now - start;
let fraction = elapsed/DELAY;
if(fraction >=1)
fraction = 1;
// ease out expo to stabilize the significative numbers quickly
const toDisplay = projectCount * (1- (fraction === 1 ? 0 : Math.pow(2, -10*fraction)));
counter.textContent = Math.round(Math.max(0, toDisplay));
if(fraction <1){
step();
}
})
})();
})
}
console.log("--- home.js / carousel ...")
if ( !window.options_car_home ){
// const carouselDiv_home = document.querySelector('#carousel-home')
// console.log("--- carouselDiv_home : ", carouselDiv_home)
// console.log("--- home.js / bulmaCarousel : ", bulmaCarousel)
const options_car_home = {
slidesToScroll: 1,
slidesToShow: 2,
infinite: true,
pagination: false,
}
console.log("--- home.js / options_car_home : ", options_car_home)
// let carouselHome = bulmaCarousel.attach('#carousel-home', options_car_home)
bulmaCarousel.attach('#carousel-home', options_car_home)
}