Created
May 15, 2013 21:27
-
-
Save rdallaire/5587538 to your computer and use it in GitHub Desktop.
Back to top with twitter bootstrap markup
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
| a.backtotop{ | |
| position: fixed; | |
| bottom: -4px; | |
| padding-bottom: 16px; | |
| right: 20px; | |
| width: 50px; | |
| } | |
| #top i{ | |
| margin: 3px 0 0 5px ; | |
| } | |
| <a href="javascript:void(0)" class="backtotop btn btn-inverse" id="top">Back to Top <i class="icon-arrow-up icon-white"></i></a> | |
| $(window).scroll(function() {// when the page is scrolled run this | |
| if ($(this).scrollTop() != 0) {// if you're NOT at the top | |
| $('#top').fadeIn("fast"); | |
| // fade in | |
| } else {// else | |
| $('#top').fadeOut("fast"); | |
| // fade out | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment