Skip to content

Instantly share code, notes, and snippets.

@About2git
Forked from srikat/front-page.php
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save About2git/d5d2fc51f70ac82df8a9 to your computer and use it in GitHub Desktop.

Select an option

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.
//* 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 );
}
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>';
}
}
jQuery(function( $ ){
$('.home-rocket').css({'top': (($(window).height()))+'px'});
$.stellar({
// DO NOT Hide parallax elements that move outside the viewport
hideDistantElements: false,
});
});
/* 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