Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if ( is_page( 'home' )) { ?> <div id="top-cta">
- #top-cta {
- background-color: #3bb618;
- text-align: center;
- padding: 11px 0 11px;
- text-transform: uppercase;
- position: fixed;
- bottom: 0;
- width: 100%;
- z-index: 9997;
- }
- #top-cta a {
- color: #fff;
- font-size: 28px;
- font-weight: 700;
- display: inline-block;
- }
- jQuery(document).ready(function() {
- var load_flag = true;
- jQuery(document).scroll(function() {
- var mywindow = jQuery(window);
- var mypos = mywindow.scrollTop();
- var up = false;
- var newscroll;
- mywindow.scroll(function () {
- newscroll = mywindow.scrollTop();
- if (newscroll > mypos && !up) {
- jQuery('#top-cta ').fadeOut();
- up = !up;
- console.log(up);
- } else if(newscroll < mypos && up) {
- jQuery('#top-cta ').fadeIn();
- up = !up;
- }
- mypos = newscroll;
- });
- });
- });
Add Comment
Please, Sign In to add comment