简体   繁体   中英

Change divs (hide/reveal) on scroll

I need some help.

I have this:

<div class="slides">

  <div class="slide 1">
     Content here.
  </div>

  <div class="slide 2">
     Content Here.
  </div>

  <div class="slide 3">
     Content Here.
  </div>

</div>

I need to swap div 1 with div 2 on mousescroll down or with slide 3 on mousescroll up, hiding an active div and revealing the neighbour one with a transition effect.

I'm not fluent with javascript, is there a simple solution?

In case someone searches for a fulfillment for a similar need:

fullPage.js does the job and they have a lean build that doesn't require jquery (in downloadable files, 5kb gzipped).

I don't care about if it's considered an answer or not, it just works and helped me a lot. I will be grateful to read more on subject and get more educated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM