{"id":8740,"date":"2021-09-08T21:01:48","date_gmt":"2021-09-08T18:01:48","guid":{"rendered":"https:\/\/elzero.org\/?p=8740"},"modified":"2022-09-28T18:09:47","modified_gmt":"2022-09-28T15:09:47","slug":"tutorials-create-our-work-filter","status":"publish","type":"post","link":"https:\/\/elzero.org\/old\/tutorials-create-our-work-filter\/","title":{"rendered":"Create Our Work Filter"},"content":{"rendered":"<h3>\u0627\u0644 Code<\/h3>\r\n\r\n<script type=\"text\/plain\" class=\"language-html\">\r\n<ul class=\"switcher\">\r\n  <li class=\"active\" data-cat=\".all\">All Work<\/li>\r\n  <li data-cat=\".web\">Web<\/li>\r\n  <li data-cat=\".gfx\">Graphic<\/li>\r\n  <li data-cat=\".marketing\">Marketing<\/li>\r\n<\/ul>\r\n<div class=\"gallery\">\r\n  <img decoding=\"async\" class=\"all web\" src=\"https:\/\/via.placeholder.com\/150\/F00\/FFF?text=Web\" alt=\"\" \/>\r\n  <img decoding=\"async\" class=\"all web\" src=\"https:\/\/via.placeholder.com\/150\/F00\/FFF?text=Web\" alt=\"\" \/>\r\n  <img decoding=\"async\" class=\"all gfx\" src=\"https:\/\/via.placeholder.com\/150\/00F\/FFF?text=Graphic\" alt=\"\" \/>\r\n  <img decoding=\"async\" class=\"all gfx\" src=\"https:\/\/via.placeholder.com\/150\/00F\/FFF?text=Graphic\" alt=\"\" \/>\r\n  <img decoding=\"async\" class=\"all marketing\" src=\"https:\/\/via.placeholder.com\/150\/000\/FFF?text=Marketing\" alt=\"\" \/>\r\n  <img decoding=\"async\" class=\"all web\" src=\"https:\/\/via.placeholder.com\/150\/F00\/FFF?text=Web\" alt=\"\" \/>\r\n  <img decoding=\"async\" class=\"all web\" src=\"https:\/\/via.placeholder.com\/150\/F00\/FFF?text=Web\" alt=\"\" \/>\r\n  <img decoding=\"async\" class=\"all marketing\" src=\"https:\/\/via.placeholder.com\/150\/000\/FFF?text=Marketing\" alt=\"\" \/>\r\n  <img decoding=\"async\" class=\"all marketing\" src=\"https:\/\/via.placeholder.com\/150\/000\/FFF?text=Marketing\" alt=\"\" \/>\r\n  <img decoding=\"async\" class=\"all gfx\" src=\"https:\/\/via.placeholder.com\/150\/00F\/FFF?text=Graphic\" alt=\"\" \/>\r\n<\/div>\r\n<\/script>\r\n\r\n<script type=\"text\/plain\" class=\"language-css\">\r\nbody {\r\n  font-family: Arial, Helvetica, sans-serif;\r\n}\r\n.switcher {\r\n  display: flex;\r\n  justify-content: center;\r\n  list-style: none;\r\n  padding: 0;\r\n}\r\n.switcher li {\r\n  padding: 10px 15px;\r\n  font-weight: bold;\r\n  cursor: pointer;\r\n  background-color: #eee;\r\n  min-width: 105px;\r\n  text-align: center;\r\n  transition: 0.2s;\r\n}\r\n.switcher li.active,\r\n.switcher li:hover {\r\n  background-color: red;\r\n  color: white;\r\n}\r\n.gallery {\r\n  display: flex;\r\n  flex-wrap: wrap;\r\n  width: 800px;\r\n  margin: auto;\r\n}\r\n.gallery img {\r\n  margin-bottom: 10px;\r\n  transition: 0.3s;\r\n  margin-left: 5px;\r\n  margin-right: 5px;\r\n}\r\n<\/script>\r\n\r\n<script type=\"text\/plain\" class=\"language-javascript\">\r\nlet switcherLis = document.querySelectorAll(\".switcher li\");\r\nlet imgs = Array.from(document.images);\r\n\r\nswitcherLis.forEach((li) => {\r\n  li.addEventListener(\"click\", removeActive);\r\n  li.addEventListener(\"click\", manageImgs);\r\n});\r\n\r\n\/\/ Remove Active Class From All Lis And Add To Current\r\nfunction removeActive() {\r\n  switcherLis.forEach((li) => {\r\n    li.classList.remove(\"active\");\r\n    this.classList.add(\"active\");\r\n  });\r\n}\r\n\r\n\/\/ Manage Imgs\r\nfunction manageImgs() {\r\n  imgs.forEach((img) => {\r\n    img.style.display = \"none\";\r\n  });\r\n  document.querySelectorAll(this.dataset.cat).forEach((el) => {\r\n    el.style.display = \"block\";\r\n  });\r\n}\r\n<\/script>","protected":false},"excerpt":{"rendered":"<p>\u0627\u0644 Code<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[879],"tags":[],"class_list":["post-8740","post","type-post","status-publish","format-standard","hentry","category-front-end-tutorials"],"_links":{"self":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8740","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/comments?post=8740"}],"version-history":[{"count":1,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8740\/revisions"}],"predecessor-version":[{"id":8741,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8740\/revisions\/8741"}],"wp:attachment":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/media?parent=8740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/categories?post=8740"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/tags?post=8740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}