javascript - Skrollr - How to stop the div stop scrolling when reaching top ot window -


i trying make website using skrollr (javascript library): http://prinzhorn.github.io/skrollr/

the scrollr works fine, not able figure out 1 thing. how stop div scrolling further away top of screen. once top of div hits top of page, want stop scrolling, when second div starts coming on top of it, gives feeling of stacked cards.

and when scrolling back, div start scroll after 1 on top has left bottom of page.

i hope explanation bit clear, if not try explain using graphics.

now code part. after reading documentation, tried both these:

data-top , data-end none of them worked actually.

i tried: data-top="background-position:0px 0px;"

i not sure if want achieve possible or not.

if not, can overlapping vertical scrolling reducing scroll speed after top of div crosses top of browser window.

please ask me if of explanation confusing, know it's not easy explain problem verbally.

skrollr not magic, css. if want div stop, find way using css. accomplished using fixed positioning.

like (not tested, should give idea)

<section data-0="position:static;" data-top="position:fixed;"></section> 

now 1 problem occur. following elements move up, because element taken out of flow. solve example using dummy-element or margin-top or top (with relative positioning) in conjunction data-anchor-target pointing element.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -