Skip to content

Instantly share code, notes, and snippets.

@SpiritOfDarkDragon
Created July 24, 2014 12:22
Show Gist options
  • Save SpiritOfDarkDragon/3c764b9178acc076569f to your computer and use it in GitHub Desktop.
Save SpiritOfDarkDragon/3c764b9178acc076569f to your computer and use it in GitHub Desktop.
Как определить, прокрутили ли мы scroll до самого верха.
/////JS/////
$(window).scroll(function(){
if ($(this).scrollTop() == 0) {
$('span').html("верх");
}
else {
$('span').html("не верх");
}
});
////CSS////
div {
height:2000px;
}
span {
position:fixed;
left:0;
top:0;
font-size:3em;
color:red;
}
////HTML////
<div></div>
<span>верх</span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment