Browse Source

celý projekt

master
Lukáš Helcl 4 years ago
parent
commit
6f789e88c3
  1. 16
      data.json
  2. BIN
      images/image_01.jpg
  3. BIN
      images/image_02.jpg
  4. BIN
      images/image_03.jpg
  5. BIN
      images/image_04.jpg
  6. BIN
      images/image_05.jpg
  7. BIN
      images/image_06.jpg
  8. BIN
      images/image_07.jpg
  9. BIN
      images/image_08.jpg
  10. BIN
      images/image_09.jpg
  11. BIN
      images/image_10.jpg
  12. BIN
      images/image_11.jpg
  13. BIN
      images/image_12.jpg
  14. BIN
      images/image_13.jpg
  15. BIN
      images/image_14.jpg
  16. BIN
      images/image_15.jpg
  17. BIN
      images/image_16.jpg
  18. BIN
      images/image_17.jpg
  19. BIN
      images/image_18.jpg
  20. BIN
      images/image_19.jpg
  21. BIN
      images/image_20.jpg
  22. BIN
      images/image_21.jpg
  23. BIN
      images/image_22.jpg
  24. BIN
      images/image_23.jpg
  25. BIN
      images/image_24.jpg
  26. BIN
      images/image_25.jpg
  27. BIN
      images/image_26.jpg
  28. BIN
      images/image_27.jpg
  29. BIN
      images/image_28.jpg
  30. BIN
      images/image_29.jpg
  31. BIN
      images/image_30.jpg
  32. BIN
      images/image_31.jpg
  33. BIN
      images/image_32.jpg
  34. BIN
      images/image_33.jpg
  35. BIN
      images/image_34.jpg
  36. BIN
      images/image_35.jpg
  37. BIN
      images/image_36.jpg
  38. BIN
      images/image_37.jpg
  39. BIN
      images/image_38.jpg
  40. BIN
      images/image_39.jpg
  41. BIN
      images/image_40.jpg
  42. BIN
      images/image_41.jpg
  43. BIN
      images/image_42.jpg
  44. 83
      index.html
  45. 2
      jquery-3.5.1.min.js
  46. 41
      test.txt

16
data.json

@ -0,0 +1,16 @@
{
"obrazek": "images/image_04.jpg",
"text": "Toto je textová informace 1",
"obrazek_s": [
"image_01.jpg",
"image_02.jpg",
"image_03.jpg"
],
"text_s": [
"Toto je textová informace 1",
"Toto je textová informace 2",
"Toto je textová informace 3"
]
}

BIN
images/image_01.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

BIN
images/image_02.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

BIN
images/image_03.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

BIN
images/image_04.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

BIN
images/image_05.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

BIN
images/image_06.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
images/image_07.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
images/image_08.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

BIN
images/image_09.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

BIN
images/image_10.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

BIN
images/image_11.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

BIN
images/image_12.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 KiB

BIN
images/image_13.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB

BIN
images/image_14.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

BIN
images/image_15.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

BIN
images/image_16.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

BIN
images/image_17.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

BIN
images/image_18.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
images/image_19.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

BIN
images/image_20.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
images/image_21.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

BIN
images/image_22.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
images/image_23.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
images/image_24.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
images/image_25.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

BIN
images/image_26.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 KiB

BIN
images/image_27.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

BIN
images/image_28.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

BIN
images/image_29.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

BIN
images/image_30.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

BIN
images/image_31.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

BIN
images/image_32.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
images/image_33.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

BIN
images/image_34.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

BIN
images/image_35.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
images/image_36.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

BIN
images/image_37.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

BIN
images/image_38.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

BIN
images/image_39.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

BIN
images/image_40.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

BIN
images/image_41.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

BIN
images/image_42.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

83
index.html

@ -0,0 +1,83 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Obrazek dne</title>
<style>
#obrazek img {
width: 10%;
height: auto;
}
#obrazek-sam img {
width: 10%;
height: auto;
}
</style>
</head>
<body>
<h1> Obrázek dne </h1>
<h2> Zadání vytvořte soubor JSON, který umístíte do adresáře projektu
Obsah: název souboru/obrázek a popisek (motto)
Napiste kod který stahne jsoun soubor a sna stánce zobrazi obrázek získaný z json souboru a popisek (textovací informace).
</h2>
<div>
<div id="obrazek"> </div>
<div id="text"> </div>
<div id="obrazek-sam"> </div>
</div>
<script src="jquery-3.5.1.min.js"></script>
<script>
$.getJSON("/data.json")
.done(function(data) {
console.log(data);
console.log(data.text_s);
console.log(data.obrazek_s);
let div = $("#obrazek")
let p = $("#text")
for (let index = 0; index < data.text_s.length; index++) {
const tx = data.text_s[index];
p.append("<label>" + tx + "</label>")
}
for (let index = 0; index < data.obrazek_s.length; index++) {
const obr = data.obrazek_s[index];
div.append("<img src='images/" + obr + "' >")
}
})
.fail(function() {
console.log("chyba");
alert("Chyba se řeší")
})
.always(function() {
console.log("Vždycky")
});
function stahniObrazek () {
$.getJSON("/data.json")
.done(function(data) {
let puvodni = $("#obrazek-sam img").attr("src");
console.log(puvodni);
if (puvodni != data.obrazek) {
$("#obrazek-sam").html("<img src='" + data.obrazek + "' >").append("<label>" + data.text + "</label>");
}
})
}
window.setInterval(stahniObrazek, 5000)
</script>
</body>
</html>

2
jquery-3.5.1.min.js

File diff suppressed because one or more lines are too long

41
test.txt

@ -0,0 +1,41 @@
<script src="jquery-3.5.1.min.js"></script>
<script>
function stahniJSON() {
$.getJSON("/data.json")
.done(function(data) {
console.log(data);
let div = $("#obrazek")
let p = $("#text")
for (let index = 0; index < data.symboly.length; index++) {
const tx = text[index];
p.append("<label>" + tx + "</label>")
}
for (let index = 0; index < data.symboly.length; index++) {
const obr = obrazek[index];
div.append("<img src='images/" + obr + "' >")
}
})
.fail(function() {
console.log("chyba");
alert("Chyba se řeší")
})
.always(function() {
console.log("Vždycky")
});
}
</script>
"obrazek_s": [
"image_01.jpg",
"image_02.jpg",
"image_03.jpg"
],
"text_s": [
"Toto je textová informace 1",
"Toto je textová informace 2",
"Toto je textová informace 3"
]
Loading…
Cancel
Save