Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. var tmp = $(window).height();
  2.  
  3. <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"> </script>
  4. <script src="bootstrap-3.1.1-dist/js/bootstrap.min.js"></script>
  5. <script src="http://malsup.github.com/jquery.form.js"></script>
  6. <script src="/jquery/isInViewport.min.js"></script>
  7.  
  8.  
  9.  
  10. $(window).scroll(function() {
  11. if($('#pageStart:in-viewport(tmp)')){
  12. $("#arrow-up").hide("slow");
  13. }else{
  14. $("#arrow-up").show("slow");
  15. }
  16. });
  17.  
  18. // fade in #back-top
  19. $(function () {
  20. $(window).scroll(function () {
  21. if ($(this).scrollTop() > 300) {
  22. $('.back-top').fadeIn();
  23. } else {
  24. $('.back-top').fadeOut();
  25. }
  26. });
  27.  
  28. // scroll body to 0px on click
  29. $('.back-top').click(function () {
  30. $('body,html').animate({
  31. scrollTop: 0
  32. }, 1600);
  33. return false;
  34. });
  35. });
  36.  
  37. .back-top {
  38. width:25px;
  39. height:25px;
  40. background:#ff0000;
  41. position:fixed;
  42. bottom:68px;
  43. right:5px;
  44. display:none;
  45. opacity:0.8;
  46. }
  47.  
  48. <div class="back-top" title="Top of Page"></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement