Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active August 29, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save srikat/8702363 to your computer and use it in GitHub Desktop.
Save srikat/8702363 to your computer and use it in GitHub Desktop.
Using ScrollReveal.js to fade in posts in Genesis. http://sridharkatakam.com/using-scrollreveal-js-fade-posts-genesis/
//* Enqueue ScrollReveal.js
add_action( 'wp_enqueue_scripts', 'enqueue_scrollreveal' );
function enqueue_scrollreveal() {
wp_enqueue_script( 'scrollreveal', get_stylesheet_directory_uri() . '/js/scrollReveal.min.js', array( 'jquery' ), '', true );
}
add_filter( 'genesis_attr_entry', 'custom_genesis_attributes_entry' );
/**
* Add attributes for entry element.
*
* @since 2.0.0
*
* @global WP_Post $post Post object.
*
* @param array $attributes Existing attributes.
*
* @return array Amended attributes.
*/
function custom_genesis_attributes_entry( $attributes ) {
global $wp_query;
if ( ($wp_query->current_post > 0) )
$attributes['data-scroll-reveal'] = 'enter from the left over 1.5s';
if ( is_singular() )
$attributes['data-scroll-reveal'] = 'enter from the top over 1.5s';
return $attributes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment