-3

I'm currently trying to get a div container to slide in from one side once the user has scrolled down a certain amount of px and disappear after the user has scrolled down another set amount of px.

This page has what I want to do - http://2014.igem.org/Team:CU-Boulder

If anyone can help me, I'd really appreciate it.

Pshemo
  • 122,468
  • 25
  • 185
  • 269
Aoife
  • 11
  • 3
  • possible duplicate of [Show div on scrollDown after 800px](http://stackoverflow.com/questions/15798360/show-div-on-scrolldown-after-800px) – TechWisdom Jul 06 '15 at 14:05
  • can I have several of those appear if I use that code? Also, I don't think it helps me with the slide in aspect. I don't want it to fade in :) – Aoife Jul 06 '15 at 14:09
  • okay, that's not what I want. If you check the link provided it illustrates what I am trying to do. – Aoife Jul 06 '15 at 14:12
  • ok @Aoife, I answered to show how you can get scroll data and use it to build your logic. Hope it helps. – TechWisdom Jul 06 '15 at 14:22

1 Answers1

0

To get user's scroll data you can use scrollTop() jQuery method.

Description: Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element.

For example:

$(window).scroll(function() {
    var currentHeight = $(window).scrollTop();

    if (currentHeight > 200) {
        // some action
    }
    if (currentHeight > 300) {
        // another action
    }
});

You might be interested looking at this WOW plugin, or at this scrollrevealjs.

TechWisdom
  • 3,960
  • 4
  • 33
  • 40