Using ScrollReveal.js to fade in posts in Genesis. http://sridharkatakam.com/using-scrollreveal-js-fade-posts-genesis/
This file contains 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
//* 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 ); | |
} |
This file contains 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_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