Try this to set the alert if you’ve scrolled 100px from the top of the page.
jQuery(document).ready(function ($) {
$(window).scroll(function(){
var ScrollTop = parseInt($(window).scrollTop());
if (ScrollTop > 100) {
alert("You've scrolled 100 pixels.");
}
});
});
Here is a JSFiddle showing it in action.
Assuming you want to do more than just show an alert, here would be how you add a class of “scroll” to an element with the class of “site-header” and have it removed when you are less than 100px from the top of the browser window:
jQuery(document).ready(function ($) {
$(window).scroll(function(){
var ScrollTop = parseInt($(window).scrollTop());
if (ScrollTop > 100) {
$( ".site-header" ).addClass( "scroll" );
}else{
$( ".site-header" ).removeClass( "scroll" );
}
});
});