Last active
November 17, 2016 18:54
-
-
Save srikat/7957483 to your computer and use it in GitHub Desktop.
Using Waypoints jQuery to animate and fade in elements as they come in focus in WordPress. http://sridharkatakam.com/using-waypoints-jquery-animate-fade-elements-scrolled-wordpress/
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-featured .simple-social-icons ul li a.animate { | |
-webkit-transform: rotate(360deg); | |
-moz-transform: rotate(360deg); | |
-o-transform: rotate(360deg); | |
-ms-transform: rotate(360deg); | |
transform: rotate(360deg); | |
-webkit-transition: all 1s ease; | |
-moz-transition: all 1s ease; | |
-o-transition: all 1s ease; | |
-ms-transition: all 1s ease; | |
transition: all 1s ease; | |
} | |
.home-featured .widget-title, | |
.home-featured .textwidget { | |
display: none; | |
} |
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( 'wp_enqueue_scripts', 'include_waypoints' ); | |
function include_waypoints() { | |
if ( !is_front_page() ) | |
return; | |
wp_enqueue_script( 'waypoints', get_stylesheet_directory_uri() . '/js/waypoints.min.js', array( 'jquery' ), '1.0.0' ); | |
wp_enqueue_script( 'waypoints-init', get_stylesheet_directory_uri() .'/js/waypoints-init.js' , array( 'jquery', 'waypoints' ), '1.0.0' ); | |
} |
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($) { | |
$('.site-tagline').waypoint(function() { | |
$('.home-featured .simple-social-icons ul li a').toggleClass( 'animate' ); | |
$('.home-featured .widget-title').fadeIn( 1500 ); | |
$('.home-featured .textwidget').fadeIn( 3500 ); | |
}, | |
{ | |
offset: '50%', | |
triggerOnce: true | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment