Created
February 5, 2020 20:21
-
-
Save patrickposner/659519b816c9848cb65293d19e77832b to your computer and use it in GitHub Desktop.
Passster scroll down with conditional function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* add additional content to passster */ | |
| add_filter( 'passster_content', 'passster_scroller_element', 10, 1 ); | |
| function passster_scroller_element( $content ) { | |
| $content .= '<span id="passster-scroll"></span>'; | |
| return $content; | |
| } | |
| /* add a auto scroller when content successfully unlocked */ | |
| add_action( 'wp_footer', 'passster_scroll' ); | |
| function passster_scroll() { | |
| if ( true === passster\PS_Conditional::is_password_valid( 'password' ) ): ?> | |
| <script> | |
| jQuery(document).ready(function( $ ) { | |
| $('html, body').animate({ | |
| scrollTop: $('#passster-scroll').offset().top | |
| }, 'slow'); | |
| }); | |
| </script> | |
| <?php endif; ?> | |
| <?php | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment