jquery : detecting scroll position jquery : detecting scroll position jquery jquery

jquery : detecting scroll position


Working DEMO

Try this

$(window).scroll(function () {    if ($(window).scrollTop() + $(window).height() > $('.footer').offset().top) {        alert("footer visible");    } else {        alert("footer invisible");    }});

Hope this helps,Thank you


There is a jquery plugin for this task named jQuery Waypoints (http://imakewebthings.com/jquery-waypoints/)

$('#footer').waypoint(function(direction) {    alert('Top of thing hit top of viewport.');});


here is a working fiddle...http://jsfiddle.net/kasperfish/JRUnr/14/

it is hacked together but it works

        flag=true;$(window).scroll(function() {    st=$(window).scrollTop();    $('#topscroll').html(st)    if(st>1450){        if(flag)        alert('test');flag=false;    }});