-
-
Save incidunt/7de37a1ab3be89c106f8d9f2de626499 to your computer and use it in GitHub Desktop.
Fading in last sidebar widget as it is scrolled to and making it fixed in Genesis. http://sridharkatakam.com/fade-last-sidebar-widget-scrolled-make-fixed-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
add_action( 'wp_enqueue_scripts', 'enqueue_sticky_last_widget' ); | |
function enqueue_sticky_last_widget() { | |
wp_enqueue_style( 'animate', get_stylesheet_directory_uri() . '/css/animate.min.css' ); | |
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' ); | |
wp_enqueue_script( 'jquery-sticky', get_stylesheet_directory_uri() .'/js/jquery.sticky.js' , array( 'jquery' ), '1.0.0' ); | |
wp_enqueue_script( 'jquery-sticky-init', get_stylesheet_directory_uri() .'/js/jquery.sticky.init.js' , array( 'jquery-sticky' ), '1.0.0' ); | |
} |
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
jQuery(document).ready(function($) { | |
$(".sidebar-primary .widget:last-child").sticky({getWidthFrom: ".sidebar-primary .sticky-wrapper", className: "stuck"}); | |
}); |
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
/* | |
Fading in last sidebar widget as it is scrolled to and making it fixed | |
-----------------------------------------------------------------------------*/ | |
.sidebar-primary .widget:last-child { | |
filter: alpha(opacity=0); | |
opacity: 0; | |
/*animation-duration: 1.5s;*/ | |
} | |
.admin-bar .stuck .widget { | |
top: 28px !important; | |
/*top: 68px !important;*/ | |
} |
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
jQuery(function($) { | |
$('.sidebar-primary .widget:last-child').waypoint(function(direction) { | |
if (direction == 'up') { | |
$(this).removeClass( 'fadeIn' ).addClass( 'fadeOut' ); | |
} | |
else { | |
$(this).removeClass('fadeOut').addClass( 'animated fadeIn' ); | |
} | |
}, | |
{ | |
offset: '50%', | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment