Last active
December 3, 2018 14:01
-
-
Save celticwebdesign/b9faa30950e6a26aec211553c7a6a30a to your computer and use it in GitHub Desktop.
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
var showingSlider = false; | |
function show_hide_div_on_scroll_jquery() { | |
if ($(window).scrollTop()>300) | |
{ | |
if (!showingSlider){ | |
showingSlider=true; | |
$('#header-hidden').animate({ | |
top: 0, | |
opacity: 1, | |
}, 500); | |
} | |
} | |
else | |
{ | |
if (showingSlider){ | |
showingSlider=false; | |
$('#header-hidden').animate({ | |
top: -150, | |
opacity: 0, | |
}, 500); | |
} | |
} | |
} | |
show_hide_div_on_scroll_jquery(); | |
// https://tutorialdeep.com/knowhow/show-hide-div-on-scroll-jquery/ | |
// https://stackoverflow.com/a/26171569 | |
$(window).scroll(function() { | |
show_hide_div_on_scroll_jquery(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment