{"id":568,"date":"2023-03-11T01:43:41","date_gmt":"2023-03-10T22:43:41","guid":{"rendered":"https:\/\/notes.profidev.online\/?p=568"},"modified":"2023-03-28T23:53:36","modified_gmt":"2023-03-28T20:53:36","slug":"scroll-effekt-smeny-izobrazhenij","status":"publish","type":"post","link":"https:\/\/notes.profidev.online\/ru\/effect\/568\/","title":{"rendered":"Scroll effect of changing images"},"content":{"rendered":"\n<figure class=\"wp-block-video\"><video height=\"728\" style=\"aspect-ratio: 1348 \/ 728;\" width=\"1348\" controls src=\"https:\/\/notes.profidev.online\/wp-content\/uploads\/2023\/03\/vokoscreenng-2023-03-10_23-39-47.webm\"><\/video><\/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;}\">&lt;main&gt;\n  &lt;section class=&quot;mast&quot;&gt;\n     &lt;figure class=&quot;mast__bg&quot; style=&quot;background-image:url(https:\/\/unsplash.it\/1800\/800?image=1033)&quot;&gt;&lt;\/figure&gt;\n    &lt;header class=&quot;mast__header  js-clippy&quot;&gt;\n        &lt;h5 class=&quot;mast__pretitle&quot;&gt;Scroll Fool&lt;\/h5&gt;\n        &lt;h2 class=&quot;mast__title&quot;&gt;Let's Get Clippy&lt;\/h2&gt;\n        &lt;hr class=&quot;sep&quot;&gt;\n    &lt;\/header&gt;\n  &lt;\/section&gt;\n  \n  &lt;section class=&quot;mast&quot;&gt;\n     &lt;figure class=&quot;mast__bg&quot; style=&quot;background-image:url(https:\/\/unsplash.it\/1800\/800?image=1008)&quot;&gt;&lt;\/figure&gt;\n    &lt;header class=&quot;mast__header  js-clippy&quot;&gt;\n      &lt;h5 class=&quot;mast__pretitle&quot;&gt;Go On Mon&lt;\/h5&gt;\n      &lt;h2 class=&quot;mast__title&quot;&gt;Clip Rect In Effect&lt;\/h2&gt;\n      &lt;hr class=&quot;sep&quot;&gt;\n    &lt;\/header&gt;\n  &lt;\/section&gt;\n    \n  &lt;section class=&quot;mast&quot;&gt;\n     &lt;figure class=&quot;mast__bg&quot; style=&quot;background-image:url(https:\/\/unsplash.it\/1800\/800?image=945)&quot;&gt;&lt;\/figure&gt;\n  &lt;header class=&quot;mast__header  js-clippy&quot;&gt;\n    &lt;h5 class=&quot;mast__pretitle&quot;&gt;We Done Son&lt;\/h5&gt;\n    &lt;h2 class=&quot;mast__title&quot;&gt;Getting All Recty&lt;\/h2&gt;\n    &lt;hr class=&quot;sep&quot;&gt;\n  &lt;\/header&gt;\n  &lt;\/section&gt;\n    \n  &lt;\/main&gt;\n  \n  &lt;div class=&quot;border-top&quot;&gt;&lt;\/div&gt;\n  &lt;div class=&quot;border-left&quot;&gt;&lt;\/div&gt;\n\n&lt;script src=&quot;\/\/cdnjs.cloudflare.com\/ajax\/libs\/jquery\/2.1.3\/jquery.min.js&quot;&gt;&lt;\/script&gt;\n\/\/\u0421\u043a\u0440\u0438\u043f\u0442 js \u043d\u0430\u0434\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c\n\/\/\u0410\u0432\u0442\u043e\u0440: Stephen Scaff. @StephenScaff<\/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;}\">*, *:before, *:after {\n  box-sizing: border-box;\n  min-width: 0;\n  min-height: 0;\n  margin: 0;\n  padding: 0;\n}\n\nbody {\n  margin: 0;\n  width: 100%;\n  font-family: &quot;Source Sans Pro&quot;;\n  font-weight: 400;\n  font-style: normal;\n  -ms-text-size-adjust: 100%;\n  -webkit-text-size-adjust: 100%;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n  text-rendering: optimizeLegibility;\n}\n\n.border-top {\n  width: 100%;\n  height: 0.75em;\n  top: 0;\n  width: 0;\n  -webkit-animation: ani-width ease-in-out 0.5s 0s both;\n          animation: ani-width ease-in-out 0.5s 0s both;\n}\n.border-top:after {\n  content: &quot;&quot;;\n  bottom: 0;\n  width: 100%;\n  height: 0.75em;\n  right: 0;\n  -webkit-animation: ani-width ease-in-out 0.5s 1s both;\n          animation: ani-width ease-in-out 0.5s 1s both;\n}\n\n.border-left {\n  height: 100%;\n  width: 0.75em;\n  left: 0;\n  bottom: 0;\n  -webkit-animation: ani-height ease-in-out 0.5s 1.5s both;\n          animation: ani-height ease-in-out 0.5s 1.5s both;\n}\n.border-left:after {\n  content: &quot;&quot;;\n  right: 0;\n  top: 0;\n  height: 100%;\n  width: 0.75em;\n  -webkit-animation: ani-height ease-in-out 0.5s 0.5s both;\n          animation: ani-height ease-in-out 0.5s 0.5s both;\n}\n\n.border-top,\n.border-top:after,\n.border-left,\n.border-left:after {\n  position: fixed;\n  z-index: 9;\n  background-color: #fff;\n}\n\nh2 {\n  font-family: &quot;Playfair Display&quot;;\n  font-weight: 700;\n  font-size: 1.75em;\n  line-height: 1.2;\n}\n@media (min-width: 32em) {\n  h2 {\n    font-size: 4em;\n  }\n}\n\nhr.sep {\n  border: 0px;\n  height: 1px;\n  background: #fff;\n  margin: 1.4em auto;\n  width: 3em;\n}\n\nmain &gt; section:nth-child(1):not(.site-menu), main &gt; article:nth-child(1):not(.site-menu) {\n  z-index: 2;\n}\nmain &gt; section:nth-child(2):not(.site-menu), main &gt; article:nth-child(2):not(.site-menu) {\n  z-index: 3;\n}\nmain &gt; section:nth-child(3):not(.site-menu), main &gt; article:nth-child(3):not(.site-menu) {\n  z-index: 4;\n}\n\n.mast {\n  position: relative;\n  display: flex;\n  align-items: center;\n  height: 100vh;\n  width: 100%;\n  color: #fff;\n  margin-bottom: 1em;\n}\n.mast:after {\n  content: &quot;&quot;;\n  z-index: 0;\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  background: rgba(0, 0, 0, 0.7);\n}\n.mast__bg {\n  position: absolute;\n  top: 0;\n  left: 0;\n  height: 100%;\n  width: 100%;\n  margin: 0 auto;\n  padding: 0;\n  background-size: cover;\n  background-color: #111;\n  -webkit-animation: fade-in 1s ease both;\n          animation: fade-in 1s ease both;\n}\n.mast__header {\n  z-index: 5;\n  position: fixed;\n  width: 100%;\n  top: 45%;\n  text-align: center;\n  -webkit-animation: fade-in 2s 1.5s ease both;\n          animation: fade-in 2s 1.5s ease both;\n}\n.mast__pretitle {\n  margin-bottom: 0.5em;\n  font-size: 1em;\n  font-weight: 400;\n  text-transform: uppercase;\n  letter-spacing: 0.15em;\n}\n\n@-webkit-keyframes fade-in {\n  0% {\n    opacity: 0;\n  }\n  100% {\n    opacity: 1;\n  }\n}\n\n@keyframes fade-in {\n  0% {\n    opacity: 0;\n  }\n  100% {\n    opacity: 1;\n  }\n}\n@-webkit-keyframes ani-width {\n  0% {\n    width: 0;\n  }\n  100% {\n    width: 100%;\n  }\n}\n@keyframes ani-width {\n  0% {\n    width: 0;\n  }\n  100% {\n    width: 100%;\n  }\n}\n@-webkit-keyframes ani-height {\n  0% {\n    height: 0;\n  }\n  100% {\n    height: 100%;\n  }\n}\n@keyframes ani-height {\n  0% {\n    height: 0;\n  }\n  100% {\n    height: 100%;\n  }\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;}\">\/*---------------------------------------------\nClippy Headings\n- Creates a scrolling cliprect effect on fixed headings\n----------------------------------------------*\/\n\n(function ($) {\n  var s,\n    clippy = {\n      settings: {\n        heading: $(&quot;.js-clippy&quot;)\n      },\n      init: function () {\n        s = this.settings;\n        this.bindEvents();\n      },\n      bindEvents: function () {\n        $(window).on(&quot;load resize scroll&quot;, $.proxy(this.getClippy, this));\n      },\n\n      getClippy: function () {\n        s.heading.each(function () {\n          var layerOffset = $(this).closest(&quot;article, section&quot;).offset(),\n            containerOffset = layerOffset.top - $(window).scrollTop(),\n            clippy =\n              containerOffset -\n              $(this)\n                .css(&quot;top&quot;)\n                .replace(\/[^-\\d\\.]\/g, &quot;&quot;) -\n              $(this)\n                .css(&quot;margin-top&quot;)\n                .replace(\/[^-\\d\\.]\/g, &quot;&quot;);\n          $(this).css(&quot;clip&quot;, &quot;rect(&quot; + clippy + &quot;px, auto, auto, auto)&quot;);\n        });\n      }\n    };\n  clippy.init();\n})(jQuery);<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":569,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[17,44],"class_list":["post-568","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-effect","tag-jquery","tag-scroll"],"_links":{"self":[{"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/posts\/568","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=568"}],"version-history":[{"count":0,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/posts\/568\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/media\/569"}],"wp:attachment":[{"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/media?parent=568"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/categories?post=568"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/tags?post=568"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}