Skip to content

Instantly share code, notes, and snippets.

@srikat

srikat/gist:8702363

Last active Aug 29, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.