{"id":1620,"date":"2023-06-21T23:27:31","date_gmt":"2023-06-21T20:27:31","guid":{"rendered":"https:\/\/notes.profidev.online\/?p=1620"},"modified":"2023-06-21T23:27:33","modified_gmt":"2023-06-21T20:27:33","slug":"portfolio-with-transitions","status":"publish","type":"post","link":"https:\/\/notes.profidev.online\/ru\/headermenu\/1620\/","title":{"rendered":"Portfolio with transitions"},"content":{"rendered":"\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Portfolio with transitions\" width=\"640\" height=\"480\" src=\"https:\/\/www.youtube.com\/embed\/jRKqpRLvEPM?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text\/html&quot;,&quot;theme&quot;:&quot;cobalt&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:false,&quot;fileName&quot;:&quot;&quot;,&quot;TrpContentRestriction&quot;:{&quot;restriction_type&quot;:&quot;exclude&quot;,&quot;selected_languages&quot;:[],&quot;panel_open&quot;:true},&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}\">\n&lt;div class=&quot;wrapper&quot;&gt;\n  &lt;div class=&quot;button-previous&quot;&gt;&amp;#10094;&lt;\/div&gt;\n  &lt;div class=&quot;square-wrapper&quot;&gt;\n    &lt;div class=&quot;square&quot;&gt;\n      &lt;div class=&quot;content-wrapper&quot; style=&quot;background-image: url('https:\/\/images.unsplash.com\/photo-1685171755238-0b1c05b0fd84?ixlib=rb-4.0.3&amp;ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&amp;auto=format&amp;fit=crop&amp;w=1074&amp;q=80') &quot;&gt; \n        &lt;div class=&quot;content&quot;&gt; \n          &lt;div class=&quot;text&quot;&gt;This is the content of the Home page.&lt;\/div&gt;\n          &lt;div class=&quot;close-button&quot;&gt;X&lt;\/div&gt;\n        &lt;\/div&gt;\n      &lt;\/div&gt;\n      &lt;div class=&quot;label&quot;&gt;Home&lt;\/div&gt;\n    &lt;\/div&gt;\n    &lt;div class=&quot;square&quot;&gt;\n      &lt;div class=&quot;content-wrapper&quot; style=&quot;background-image: url('https:\/\/images.unsplash.com\/photo-1682685797898-6d7587974771?ixlib=rb-4.0.3&amp;ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&amp;auto=format&amp;fit=crop&amp;w=1170&amp;q=80');&quot;&gt; \n        &lt;div class=&quot;content&quot;&gt; \n          &lt;div class=&quot;text&quot;&gt;This is the content of the Gallery page.&lt;\/div&gt;\n          &lt;div class=&quot;close-button&quot;&gt;X&lt;\/div&gt;\n        &lt;\/div&gt;\n      &lt;\/div&gt;\n      &lt;div class=&quot;label&quot;&gt;Gallery&lt;\/div&gt;\n    &lt;\/div&gt;\n    &lt;div class=&quot;square&quot;&gt;\n      &lt;div class=&quot;content-wrapper&quot; style=&quot;background-image: url('https:\/\/images.unsplash.com\/flagged\/photo-1553505192-acca7d4509be?ixlib=rb-4.0.3&amp;ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&amp;auto=format&amp;fit=crop&amp;w=1190&amp;q=80');&quot;&gt; \n        &lt;div class=&quot;content&quot;&gt; \n          &lt;div class=&quot;text&quot;&gt;This is the content of the Portfolio page.&lt;\/div&gt;\n          &lt;div class=&quot;close-button&quot;&gt;X&lt;\/div&gt;\n        &lt;\/div&gt;\n      &lt;\/div&gt;\n      &lt;div class=&quot;label&quot;&gt;Portfolio&lt;\/div&gt;\n    &lt;\/div&gt;\n    &lt;div class=&quot;square&quot;&gt;\n      &lt;div class=&quot;content-wrapper&quot; style=&quot;background-image: url('https:\/\/images.unsplash.com\/photo-1687073558736-531dc8bfd15b?ixlib=rb-4.0.3&amp;ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&amp;auto=format&amp;fit=crop&amp;w=1171&amp;q=80');&quot;&gt; \n        &lt;div class=&quot;content&quot;&gt; \n          &lt;div class=&quot;text&quot;&gt;This is the content of the Contact Us page.&lt;\/div&gt;\n          &lt;div class=&quot;close-button&quot;&gt;X&lt;\/div&gt;\n        &lt;\/div&gt;\n      &lt;\/div&gt;\n      &lt;div class=&quot;label&quot;&gt;Contact Us&lt;\/div&gt;\n    &lt;\/div&gt;\n    &lt;div class=&quot;square&quot;&gt;\n      &lt;div class=&quot;content-wrapper&quot; style=&quot;background-image: url('https:\/\/images.unsplash.com\/photo-1686842545569-97e13c7f992f?ixlib=rb-4.0.3&amp;ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&amp;auto=format&amp;fit=crop&amp;w=1170&amp;q=80');&quot;&gt; \n        &lt;div class=&quot;content&quot;&gt; \n          &lt;div class=&quot;text&quot;&gt;This is the content of the About page.&lt;\/div&gt;\n          &lt;div class=&quot;close-button&quot;&gt;X&lt;\/div&gt;\n        &lt;\/div&gt;\n      &lt;\/div&gt;\n      &lt;div class=&quot;label&quot;&gt;About&lt;\/div&gt;\n    &lt;\/div&gt;\n  &lt;\/div&gt;\n  &lt;div class=&quot;button-next&quot;&gt;&amp;#10095;&lt;\/div&gt;\n&lt;\/div&gt;<\/pre><\/div>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;css&quot;,&quot;mime&quot;:&quot;text\/css&quot;,&quot;theme&quot;:&quot;cobalt&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:false,&quot;fileName&quot;:&quot;&quot;,&quot;TrpContentRestriction&quot;:{&quot;restriction_type&quot;:&quot;exclude&quot;,&quot;selected_languages&quot;:[],&quot;panel_open&quot;:true},&quot;language&quot;:&quot;CSS&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;css&quot;}\">@import url(&quot;https:\/\/fonts.googleapis.com\/css?family=Lato:100,300,400,700&quot;);\nhtml,\nbody {\n  width: 100%;\n  height: 100%;\n  font-family: Lato, sans-serif;\n  color: white;\n  background-image: linear-gradient(-20deg, #2b5876 0%, #4e4376 100%);\n}\n.content-wrapper {\n  background-repeat: no-repeat !important;  \n  background-size: cover !important;\n}\n \n\n.wrapper {\n  position: absolute;\n  top: 50%;\n  left: 50%;\n  transform: translate(-50%, -50%);\n  width: 350px;\n  height: 200px;\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n}\n.wrapper div[class^=button] {\n  width: 20px;\n  height: 20px;\n  padding: 10px;\n  cursor: pointer;\n  font-size: 20px;\n  color: white;\n  text-align: center;\n  border-radius: 100%;\n}\n.wrapper div[class^=button]:hover {\n  background: #1d3461;\n  opacity: 0.8;\n}\n.wrapper div[class^=button]:active {\n  background: white;\n  opacity: 0.8;\n}\n.wrapper .square-wrapper {\n  transform: rotate(-45deg);\n  position: relative;\n  width: 150px;\n  height: 150px;\n}\n.wrapper .square-wrapper .square {\n  position: absolute;\n  box-sizing: border-box;\n  width: 100%;\n  height: 100%;\n  border: 10px solid white;\n  transition: all 0.6s cubic-bezier(0.645, 0.045, 0.355, 1);\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  opacity: 1;\n  visibility: visible;\n}\n.wrapper .square-wrapper .square.hide {\n  opacity: 0;\n  visibility: hidden;\n}\n\n\n\n.wrapper .square-wrapper .square .content-wrapper {\n  position: absolute;\n  color: white;\n  width: 100%;\n  height: 100%;\n  background: inherit;\n  will-change: transform;\n  transition: all 1.5s cubic-bezier(0.86, 0, 0.07, 1);\n}\n.wrapper .square-wrapper .square .content-wrapper .content {\n  display: none;\n  position: relative;\n  width: 100%;\n  height: 100%;\n  justify-content: center;\n  align-items: center;\n}\n.wrapper .square-wrapper .square .content-wrapper .content .text {\n  font-size: 40px;\n  font-weight: 300;\n  text-align: center;\n}\n.wrapper .square-wrapper .square .content-wrapper .content .close-button {\n  position: absolute;\n  top: 10px;\n  right: 10px;\n  font-size: 40px;\n  font-weight: 300;\n  cursor: pointer;\n}\n.wrapper .square-wrapper .square .label {\n  position: absolute;\n  top: 50%;\n  left: 50%;\n  width: 120px;\n  text-align: center;\n  transform: translate(-50%, -50%) rotate(45deg);\n  text-transform: uppercase;\n  cursor: pointer;\n  color: white;\n}\n.wrapper .square-wrapper .square.expand .content-wrapper {\n  width: 100vw;\n  height: 100vh;\n  transform: rotate(45deg);\n}\n.wrapper .square-wrapper .square.expand .label {\n  display: none;\n}\n.wrapper .square-wrapper .square.expand.show-content .content {\n  display: flex;\n}\n.wrapper .square-wrapper .square:nth-child(1) {\n  z-index: 4;\n}\n.wrapper .square-wrapper .square:nth-child(2) {\n  z-index: 3;\n}\n.wrapper .square-wrapper .square:nth-child(3) {\n  z-index: 2;\n}\n.wrapper .square-wrapper .square:nth-child(4) {\n  z-index: 1;\n}\n.wrapper .square-wrapper .square:nth-child(5) {\n  z-index: 0;\n}\n.wrapper .square-wrapper .square:nth-child(4n+1) {\n  transform-origin: left top;\n  background: #f786aa;\n}\n.wrapper .square-wrapper .square:nth-child(4n+1).hide {\n  transform: rotate(90deg);\n}\n.wrapper .square-wrapper .square:nth-child(4n+2) {\n  transform-origin: right bottom;\n  background: #f7d488;\n}\n.wrapper .square-wrapper .square:nth-child(4n+2).hide {\n  transform: rotate(-90deg);\n}\n.wrapper .square-wrapper .square:nth-child(4n+3) {\n  transform-origin: left top;\n  background: #ffa8a9;\n}\n.wrapper .square-wrapper .square:nth-child(4n+3).hide {\n  transform: rotate(-90deg);\n}\n.wrapper .square-wrapper .square:nth-child(4n+4) {\n  transform-origin: right bottom;\n  background: #f7d488;\n}\n.wrapper .square-wrapper .square:nth-child(4n+4).hide {\n  transform: rotate(90deg);\n}<\/pre><\/div>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;javascript&quot;,&quot;mime&quot;:&quot;text\/javascript&quot;,&quot;theme&quot;:&quot;cobalt&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:false,&quot;fileName&quot;:&quot;&quot;,&quot;TrpContentRestriction&quot;:{&quot;restriction_type&quot;:&quot;exclude&quot;,&quot;selected_languages&quot;:[],&quot;panel_open&quot;:true},&quot;language&quot;:&quot;JavaScript&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;js&quot;}\">let squares = document.querySelectorAll(&quot;.square&quot;);\nlet previousButton = document.querySelector(&quot;.button-previous&quot;);\nlet nextButton = document.querySelector(&quot;.button-next&quot;);\nlet currentIndex = 0;\n\npreviousButton.addEventListener(&quot;click&quot;, function () {\n  if (squares[currentIndex - 1]) {\n    squares[currentIndex - 1].classList.remove(&quot;hide&quot;);\n    currentIndex--;\n    updateButtons();\n  }\n});\n\nnextButton.addEventListener(&quot;click&quot;, function () {\n  if (squares[currentIndex + 1]) {\n    squares[currentIndex].classList.add(&quot;hide&quot;);\n    currentIndex++;\n    updateButtons();\n  }\n});\n\nfunction updateButtons() {\n  if (currentIndex === 0) {\n    previousButton.style.visibility = &quot;hidden&quot;;\n  } else {\n    previousButton.style.visibility = &quot;visible&quot;;\n  }\n  console.log(currentIndex);\n  if (currentIndex + 1 === squares.length) {\n    nextButton.style.visibility = &quot;hidden&quot;;\n  } else {\n    nextButton.style.visibility = &quot;visible&quot;;\n  }\n}\n\nfunction toggleExpand() {\n  squares[currentIndex].classList.toggle(&quot;expand&quot;);\n  setTimeout(() =&gt; {\n    squares[currentIndex].classList.toggle(&quot;show-content&quot;);\n  }, 1500);\n}\n\nArray.from(document.querySelectorAll(&quot;.label&quot;)).forEach(element =&gt; {\n  element.addEventListener(&quot;click&quot;, toggleExpand);\n});\n\nArray.from(document.querySelectorAll(&quot;.close-button&quot;)).forEach(element =&gt; {\n  element.addEventListener(&quot;click&quot;, toggleExpand);\n});\n\ninit();\n\nfunction init() {\n  updateButtons();\n}<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":1621,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-1620","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-headermenu"],"_links":{"self":[{"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/posts\/1620","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/comments?post=1620"}],"version-history":[{"count":1,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/posts\/1620\/revisions"}],"predecessor-version":[{"id":1622,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/posts\/1620\/revisions\/1622"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/media\/1621"}],"wp:attachment":[{"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/media?parent=1620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/categories?post=1620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/tags?post=1620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}