Guest User

Untitled

a guest
Aug 17th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <?php if ( is_page( 'home' )) { ?> <div id="top-cta">
  2.  
  3. #top-cta {
  4. background-color: #3bb618;
  5. text-align: center;
  6. padding: 11px 0 11px;
  7. text-transform: uppercase;
  8. position: fixed;
  9. bottom: 0;
  10. width: 100%;
  11. z-index: 9997;
  12. }
  13. #top-cta a {
  14. color: #fff;
  15. font-size: 28px;
  16. font-weight: 700;
  17. display: inline-block;
  18. }
  19.  
  20. jQuery(document).ready(function() {
  21.  
  22. var load_flag = true;
  23. jQuery(document).scroll(function() {
  24.  
  25. var mywindow = jQuery(window);
  26. var mypos = mywindow.scrollTop();
  27. var up = false;
  28. var newscroll;
  29. mywindow.scroll(function () {
  30. newscroll = mywindow.scrollTop();
  31. if (newscroll > mypos && !up) {
  32. jQuery('#top-cta ').fadeOut();
  33. up = !up;
  34. console.log(up);
  35. } else if(newscroll < mypos && up) {
  36. jQuery('#top-cta ').fadeIn();
  37. up = !up;
  38. }
  39. mypos = newscroll;
  40. });
  41. });
  42. });
Add Comment
Please, Sign In to add comment