-
-
Save About2git/d5d2fc51f70ac82df8a9 to your computer and use it in GitHub Desktop.
How to move an image from bottom to top when scrolling down in Genesis.
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
| //* Load scripts on non-handhelds i.e., desktops only | |
| add_action( 'wp_enqueue_scripts', 'sk_enqueue_nonhandhelds' ); | |
| function sk_enqueue_nonhandhelds() { | |
| if ( wp_is_mobile() ) { | |
| return; | |
| } | |
| wp_enqueue_script( 'stellar', get_stylesheet_directory_uri() . '/js/jquery.stellar.min.js', array( 'jquery' ), '', true ); | |
| wp_enqueue_script( 'home-non-handhelds-js', get_stylesheet_directory_uri() . '/js/home-non-mobiles.js', array( 'stellar' ), '1.0.0', true ); | |
| } |
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
| add_action( 'genesis_after_footer', 'sk_home_rocket' ); | |
| function sk_home_rocket() { | |
| if ( is_front_page() && ! wp_is_mobile() ) { | |
| echo '<div class="home-rocket" data-stellar-ratio="2"><img src="'. get_stylesheet_directory_uri() .'/images/homeRocket.png" /></div>'; | |
| } | |
| } |
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
| jQuery(function( $ ){ | |
| $('.home-rocket').css({'top': (($(window).height()))+'px'}); | |
| $.stellar({ | |
| // DO NOT Hide parallax elements that move outside the viewport | |
| hideDistantElements: false, | |
| }); | |
| }); |
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
| /* Home Rocket */ | |
| .home-rocket { | |
| position: absolute; | |
| left: 28%; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment