mbwd-william

twentyseventeen front page slider

Jul 29th, 2021 (edited)
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.87 KB | None | 0 0
  1. <!-- Front Page Events -->
  2.         <!-- This PHP snippet hides the Upcoming Events slider from all but the front page as selected in WordPress Settings -->
  3.         <?php
  4.         if (is_front_page() )
  5.             echo '<div id="front-page-slider"' . do_shortcode('[smartslider3 slider="3"]' . '</div');
  6.  
  7.         else
  8.         { }
  9.         # do nothing ?>
  10.  
  11.         <!-- This script makes the Upcoming Events slider disappear on scrolldown and reappear on scrollup -->
  12.         <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
  13.         <script>
  14.         $(window).scroll(function() {
  15.             var y = $(this).scrollTop();
  16.             if(y > 250) {
  17.                 $('#front-page-slider').slideUp();
  18.             }
  19.             if (y < 250) {
  20.                 $('#front-page-slider').slideDown();
  21.             }
  22.             if(y+ $(this).height() == $(document).height()) {
  23.                 $('#front-page-slider').fadeOut();
  24.             }
  25.         });
  26.         </script>
  27.  
  28.  
  29.  
  30.         <!-- End Front Page Events -->
Add Comment
Please, Sign In to add comment