Created
July 24, 2014 12:22
-
-
Save SpiritOfDarkDragon/3c764b9178acc076569f to your computer and use it in GitHub Desktop.
Как определить, прокрутили ли мы scroll до самого верха.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////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