How to tell if something is scrolled into view?

This question already has an answer here:

  • Check if element is visible after scrolling 38 answers

  • As has been posted multiple times here:

    http://imakewebthings.com/jquery-waypoints/

    does exactly what you are looking for.


    Are you trying to get something like this
    Edited DEMO

    Script:

    $(function(){
            var a;var c=false;
            var b=$("#popContent");
            var e=$(window);
            var d=$('#footer').position().top;
            e.scroll(function(){
                window.clearTimeout(a);
                a=window.setTimeout(function(){
                if(e.scrollTop()<=d){
                  if(c==false)   { 
                      c=true;b.stop(true,true).show(); 
                      }else{
                             c=false;b.fadeOut(500)
    
                }}},100)})
    });
    
    链接地址: http://www.djcxy.com/p/83336.html

    上一篇: 当特定部分在屏幕上时的toggleClass

    下一篇: 如何判断是否有东西滚动到视图中?