Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. /* js */
  2. (function(){
  3. var page = $('html, body');
  4.  
  5. $('#button-up').click(function() {
  6. page.animate({scrollTop: 0}, 500);
  7. return false;
  8. });
  9.  
  10. $(window).scroll(function() {
  11. if ($(document).scrollTop() > 0) {
  12. $('#button-up').fadeIn('fast');
  13. } else {
  14. $('#button-up').fadeOut('fast');
  15. }
  16. });
  17.  
  18. })();
  19.  
  20. /* scss */
  21. #button-up {
  22. display: none;
  23. position: fixed;
  24. right: 50px;
  25. bottom: 100px;
  26. font-size: 0;
  27.  
  28. @include MQ(xs) {
  29. right: 35px;
  30. bottom: 55px;
  31. }
  32.  
  33. &:hover {
  34.  
  35. .button-up__icon {
  36. fill: $color-third;
  37. }
  38.  
  39. }
  40. }
  41.  
  42. .button-up__icon {
  43. position: absolute;
  44. top:50%;
  45. left: 50%;
  46. width: 30px;
  47. height: 30px;
  48. fill: $color-primary;
  49. @include drop-shadow(2px 2px 1px black(.15));
  50. @include center(xy);
  51. @include transition(all .3s ease);
  52. }
  53.  
  54. /* pug HTML */
  55. a(href="#")#button-up На верх
  56. +icon('arrow-up', 'button-up__icon')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement