Javascript if scroll position > 100

alert, javascript, scroll, scrolltop

Solution

Use a scroll listener http://jsfiddle.net/6A6qy/

$(window).scroll(function(){...});

Problem

How can I test it if it's greater than 100. For example how can I get an alert. Here is my code that doesn't work, I don't know why. ``` var ScrollTop = $("body").scrollTop(); if (ScrollTop > 100){ alert("Scroll is greater than 100"); //document.getElementById('back-to-top').fadeOut; } ```

Original source