javascript - Apply Opacity to Sibling Paragraphs One at a Time During Scroll Animation -


i have figure wraps few paragraphs so:

i have following style rules scroll paragraphs upon figure:hover...

figure p {      opacity:0;      }            figure:hover p {       opacity:1;       -webkit-transition: opacity 0.35s;      transition: opacity 0.35s;       margin: 0;       line-height: 50px;       text-align: center;             -webkit-transform:translatey(100%);           transform:translatey(100%);             -webkit-animation: scroll-up 5s linear infinite;       animation: scroll-up 5s linear infinite;      }            @-webkit-keyframes scroll-up {       0%   { -webkit-transform: translatey(100%); }       100% { -webkit-transform: translatey(-100%); }      }      @keyframes scroll-up {       0%   {        -webkit-transform: translatey(100%);       transform: translatey(100%);              }      50% {       opacity:1;      }       100% {        -webkit-transform: translatey(-100%);       transform: translatey(-100%);       opacity:0;        }      }
    <figure class="fig_a">                  <img src="my_url"/>                  <figcaption>                      <h2>hover somewhere around here</span></h2>                      <p>paragraph</p>                      <p>paragraph</p>                      <p>paragraph</p>                      <a href="#">view more</a>                  </figcaption>                         </figure>

note opacity style results in paragraphs becoming 100% transparent @ same time. post title suggests, i'm looking different style.

question: how can have each paragraph follow own opacity transition in tandem relative position in scroll transition? in other words, paragraphs higher on page more transparent. likewise, paragraphs lower on page more opaque.

css, js solutions welcome. not working in jquery environment, must use native js (if js needed @ all).


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -