Footer Reveal Animation On Scroll Using jQuery
| File Size: | 4.85 KB |
|---|---|
| Views Total: | 1809 |
| Last Update: | |
| Publish Date: | |
| Official Website: | Go to website |
| License: | MIT |
A small jQuery script that tracks scroll events and reveals the footer content with a custom CSS3 animation as you scroll to the very bottom of the webpage.
See Also:
How to use it:
1. Add a footer section to the webpage.
<main>
Main Content
</main>
<footer>
<div class="reveal">
Element To Reveal On Scroll
</div>
</footer>
2. Apply a reveal animation to the footer element.
footer .reveal {
transform: translateY(50px);
opacity: 0;
transition: transform, opacity;
transition-duration: .8s;
transition-timing-function: ease;
}
footer .reveal.show {
transform: translateY(0);
opacity: 1;
}
3. Load the required jQuery JavaScript library in the document.
<script src="/path/to/cdn/jquery.slim.min.js"></script>
4. The JavaScript to animation the footer element when it is scrolled into view.
var revealElement = $('footer .reveal');
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
$(revealElement).addClass('show');
} else if($(revealElement).hasClass('show') && $(window).scrollTop() + $(window).height() > $(document).height() - 150) {
$(revealElement).removeClass('show');
}
});
This awesome jQuery plugin is developed by Afarah92. For more Advanced Usages, please check the demo page or visit the official website.











