Skip to content

Instantly share code, notes, and snippets.

@mkrdip
Last active September 15, 2015 17:44
Show Gist options
  • Save mkrdip/5ab8fb680ab11c10b98e to your computer and use it in GitHub Desktop.
Save mkrdip/5ab8fb680ab11c10b98e to your computer and use it in GitHub Desktop.
// 1st one
<script>
jQuery(function($) {
$(window).scroll(function() {
if ($(this).scrollTop() > 0) {
$('.et_social_sidebar_networks').fadeIn();
} else {
$('.et_social_sidebar_networks').fadeOut();
}
});
});
</script>
// 2nd one, Another way with JS & CSS
// a) JS
<script>
jQuery(function($) {
$(window).scroll(function() {
if ($(this).scrollTop() > 500) {
$(".et_social_sidebar_networks").css('visibility','visible');
$(".et_social_sidebar_networks").fadeIn('slow');
}
else {
$(".et_social_sidebar_networks:visible").fadeOut("slow");
}
});
});
});
</script>
// b) CSS (Add via Theme Options)
.et_social_sidebar_networks {
visibility: hidden;
}
// 3rd One, Another way: Only JS
<script>
jQuery(function($) {
$(window).scroll(function(){
if($(window).scrollTop() > 500){
$("#div").fadeIn("slow");
}
});
$(window).scroll(function(){
if($(window).scrollTop() < 500){
$("#div").fadeOut("fast");
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment