Last active
October 3, 2015 14:25
-
-
Save veremey/1df9995c54d229149518 to your computer and use it in GitHub Desktop.
медленный скрол к якорю
This file contains hidden or 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
медленный скрол к якорю | |
<br /> | |
<a href="#" id="get">get click me</a> | |
<br /><br /> | |
<span class="red">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Possimus facilis molestiae deserunt ipsum optio dolorem ex sunt accusamus nulla inventore ut amet provident veritatis, voluptatem assumenda nisi mollitia aspernatur voluptatum.</span> <br /><br /> | |
<br /> | |
<span class="red">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Possimus facilis molestiae deserunt ipsum optio dolorem ex sunt accusamus nulla inventore ut amet provident veritatis, voluptatem assumenda nisi mollitia aspernatur voluptatum.</span> | |
<br /> | |
<span class="red">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Possimus facilis molestiae deserunt ipsum optio dolorem ex sunt accusamus nulla inventore ut amet provident veritatis, voluptatem assumenda nisi mollitia aspernatur voluptatum.</span> | |
<br /> | |
<br /> | |
<span class="wrap">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio excepturi repellendus id quis, cum consequuntur totam alias error esse dolore, soluta expedita neque, sed a quibusdam illo dolorum voluptatibus officiis.</span> | |
<br /> | |
<br /> | |
<br /> | |
<div id="top" href="#">top</div> |
This file contains hidden or 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
$(document).ready(function() { | |
$(document).on('click', '#get', function () { | |
$('html, body').animate({ scrollTop: $('#top').offset().top }, 1000 ); | |
return false; | |
}); | |
}); |
This file contains hidden or 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
#get{ | |
color: #c63; | |
font-style: 20px; | |
} | |
.red{ | |
display: block; | |
background-color: red; | |
width: 100px; | |
} | |
.wrap{ | |
display: block; | |
width: 100px;} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment