Browse Source

wishlist

master
petr 4 years ago
commit
5b7f51a2fd
  1. 10038
      css/bootstrap.css
  2. 1
      css/bootstrap.css.map
  3. 4
      css/moje.css
  4. BIN
      img/Thumbs.db
  5. BIN
      img/thumb_1.jpg
  6. BIN
      img/thumb_10.jpg
  7. BIN
      img/thumb_11.jpg
  8. BIN
      img/thumb_12.jpg
  9. BIN
      img/thumb_13.jpg
  10. BIN
      img/thumb_14.jpg
  11. BIN
      img/thumb_15.jpg
  12. BIN
      img/thumb_16.jpg
  13. BIN
      img/thumb_17.jpg
  14. BIN
      img/thumb_18.jpg
  15. BIN
      img/thumb_19.jpg
  16. BIN
      img/thumb_2.jpg
  17. BIN
      img/thumb_20.jpg
  18. BIN
      img/thumb_21.jpg
  19. BIN
      img/thumb_22.jpg
  20. BIN
      img/thumb_23.jpg
  21. BIN
      img/thumb_24.jpg
  22. BIN
      img/thumb_25.jpg
  23. BIN
      img/thumb_26.jpg
  24. BIN
      img/thumb_27.jpg
  25. BIN
      img/thumb_28.jpg
  26. BIN
      img/thumb_29.jpg
  27. BIN
      img/thumb_3.jpg
  28. BIN
      img/thumb_30.jpg
  29. BIN
      img/thumb_31.jpg
  30. BIN
      img/thumb_32.jpg
  31. BIN
      img/thumb_33.jpg
  32. BIN
      img/thumb_34.jpg
  33. BIN
      img/thumb_35.jpg
  34. BIN
      img/thumb_36.jpg
  35. BIN
      img/thumb_37.jpg
  36. BIN
      img/thumb_38.jpg
  37. BIN
      img/thumb_39.jpg
  38. BIN
      img/thumb_4.jpg
  39. BIN
      img/thumb_40.jpg
  40. BIN
      img/thumb_41.jpg
  41. BIN
      img/thumb_42.jpg
  42. BIN
      img/thumb_5.jpg
  43. BIN
      img/thumb_6.jpg
  44. BIN
      img/thumb_7.jpg
  45. BIN
      img/thumb_8.jpg
  46. BIN
      img/thumb_9.jpg
  47. 145
      index.html
  48. 4435
      js/bootstrap.js
  49. 1
      js/bootstrap.js.map

10038
css/bootstrap.css

File diff suppressed because it is too large

1
css/bootstrap.css.map

File diff suppressed because one or more lines are too long

4
css/moje.css

@ -0,0 +1,4 @@
#wishlist img {
width: 3rem;
padding-right: 0.5rem;
}

BIN
img/Thumbs.db

Binary file not shown.

BIN
img/thumb_1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

BIN
img/thumb_10.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
img/thumb_11.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
img/thumb_12.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
img/thumb_13.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
img/thumb_14.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
img/thumb_15.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
img/thumb_16.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

BIN
img/thumb_17.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
img/thumb_18.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
img/thumb_19.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

BIN
img/thumb_2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/thumb_20.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
img/thumb_21.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

BIN
img/thumb_22.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
img/thumb_23.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
img/thumb_24.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
img/thumb_25.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

BIN
img/thumb_26.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/thumb_27.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
img/thumb_28.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/thumb_29.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
img/thumb_3.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
img/thumb_30.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

BIN
img/thumb_31.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

BIN
img/thumb_32.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
img/thumb_33.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
img/thumb_34.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

BIN
img/thumb_35.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
img/thumb_36.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/thumb_37.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
img/thumb_38.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
img/thumb_39.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/thumb_4.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

BIN
img/thumb_40.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

BIN
img/thumb_41.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
img/thumb_42.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

BIN
img/thumb_5.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

BIN
img/thumb_6.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
img/thumb_7.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
img/thumb_8.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/thumb_9.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

145
index.html

@ -0,0 +1,145 @@
<!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>Wishlist</title>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/moje.css">
</head>
#využití boobstap využili jsme conteiner. ve všech sloup obrázky. využili jsme card. buton
<body>
<h1 class="display-1">Wishlist</h1>
<div class="container">
<div class="row">
<div class="col-md-9">
<div class="row">
<div class="col-md-3">
<div id="product-1" class="card">
<img src="img/thumb_1.jpg" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Kmen stromu</h5>
<button data-id="1" data-img="img/thumb_1.jpg" data-title="Kmen stromu" data-added="0" class="btn btn-light">Přidat na seznam</button>
</div>
</div>
</div>
<div class="col-md-3">
<div id="product-2" class="card">
<img src="img/thumb_2.jpg" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Zlatý les</h5>
<button data-id="2"data-img="img/thumb_2.jpg" data-title="Zlatý les" data-added="0" class="btn btn-light">Přidat na seznam</button>
</div>
</div>
</div>
<div class="col-md-3">
<div id="product-3" class="card">
<img src="img/thumb_3.jpg" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Mlha v údolí</h5>
<button data-id="3" data-img="img/thumb_3.jpg" data-title="Mlha v údolí" data-added="0" class="btn btn-light">Přidat na seznam</button>
</div>
</div>
</div>
<div class="col-md-3">
<div id="product-4" class="card">
<img src="img/thumb_4.jpg" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Písečný chrám</h5>
<button data-id="4" data-img="img/thumb_4.jpg" data-title="Písečný chrám" data-added="0" class="btn btn-light">Přidat na seznam</button>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div>
<button id="btnclearwishlist" class="btn btn-danger">vyprázdnit seznam</button>
</div>
<div id="wishlist"></div>
</div>
</div>
</div>
na začátku fce wishbtwclick pokud je stvrzena ukonči, když není 1 provede se kod za tím pak se dá 1. načti si wishlistt
<script>
function wishbtnclick() {
//console.log(this);
if (this.dataset.added == 1) {
return;
}
let list = document.querySelector("#wishlist");
let img = document.createElement("img");
let title = document.createElement("span")
let p = document.createElement("p")
p.setAttribute("id", "list-item-" + this.dataset.id);
p.classList = "d-flex align- items-center";
img.setAttribute("src", this.dataset.img);
title.innerText = this.dataset.title;
this.setAttribute("data-added", 1);
let btn = document.createElement("button");
btn.innerText = "x";
btn.setAttribute("title", "odebrat ze seznamu");
btn.classList = "btn btn-sm btn-info";
btn.classList = "btn btn-sm btn-info ml-auto";
btn.setAttribute("data-id", this.dataset.id);
btn.addEventListener("click", removeBtnclick);
p.append(img);
p.append(title);
p.append(btn);
list.append(p);
let card = document.querySelector("#product-" + this.dataset.id);
card.classList += " text-white bg-secondary";
}
function clearBtnClick() {
let list = document.querySelector("#wishlist");
list.innerHTML = "";
for (let index = 0; index < buttons.length; index++) {
const btn = buttons[index];
btn.setAttribute("data-added", 0);
let card = document.querySelector("#product-" + btn.dataset.id);
card.classList = "card";
}
}
function removeBtnclick(){
let id = this.dataset.id;
console.log(id);
// vymazat položku ze seznamu
let item = document.querySelector("#list-item-" + id);
item.remove();
// nastavit data-adde na 0
let btn = document.querySelector("#product-" + id + " button");
btn.setAttribute("data-added", 0);
let card = document.querySelector("#product" + btn.dataset.id);
card.classList = "card";
//ostait zvíraznění katy
}
let buttons = document.querySelectorAll(".card button");
for (let index = 0; index < buttons.length; index++) {
const btn = buttons[index];
btn.addEventListener("click", wishbtnclick);
}
let clearBtn = document.querySelector("#btnclearwishlist");
clearBtn.addEventListener("click", clearBtnClick);
</script>
</body>
</html>

4435
js/bootstrap.js

File diff suppressed because it is too large

1
js/bootstrap.js.map

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save