How to show div when user reach bottom of the page?

前端 未结 4 1733
南笙
南笙 2020-12-06 17:51

When user scrolls to the bottom of the page I want to show some div, with jQuery of course. And if user scrolls back to he top, div fade out. So how to calculate viewport (o

4条回答
  •  孤街浪徒
    2020-12-06 18:20

    This must get you started:

    
    
        
            SO question 2768264
            
            
            
        
        
            

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    p

    This assumes that body has a margin of 0. Else you'll need to add the top and bottom margin to the $('body').height().

提交回复
热议问题