-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlottie.html
80 lines (56 loc) · 2.33 KB
/
lottie.html
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bodymovin/5.4.4/lottie.min.js" type="text/javascript"></script>
<meta content = "text/html; charset = ISO-8859-1" http-equiv = "content-type">
<script type = "application/javascript">
function loadJSON() {
var data_file = "https://ws.mobile.lcl.fr/ressources-o2c/";
var http_request = new XMLHttpRequest();
try{
// Opera 8.0+, Firefox, Chrome, Safari
http_request = new XMLHttpRequest();
}catch (e) {
// Internet Explorer Browsers
try{
http_request = new ActiveXObject("Msxml2.XMLHTTP");
}catch (e) {
try{
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}catch (e) {
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
http_request.onreadystatechange = function() {
if (http_request.readyState == 4 ) {
// Javascript function JSON.parse to parse JSON data
var jsonObj = JSON.parse(http_request.responseText);
// jsonObj variable now contains the data structure and can
// be accessed as jsonObj.name and jsonObj.country.
jsonObj.resources.forEach(function(element) {
console.log(element.id);
});
lottie.loadAnimation({
container: lottie, // the dom element that will contain the animation
renderer: 'svg',
loop: true,
autoplay: true,
path: 'https://ws.mobile.lcl.fr/Ressources/JSON/prisedeRDV.json' // the path to the animation json };
});
}
}
http_request.open("GET", data_file, true);
http_request.send();
}
</script>
</head>
<body>
<div id='lottie'></div>
<script type='text/javascript'>
loadJSON();
</script>
</body>
</html>