A jQuery plugin for hide header on scroll down and show on scroll up.
<!-- jQuery -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- ScrollMenu core JS file -->
<script src="jquery.scrollmenu.min.js"></script>
$(document).ready( function() {
$('.selector').scrollMenu();
});
ScrollMenu works adding and removing a class on scroll event. You need to customize your styles. (See the CSS demo file).
ScrollMenu accepts settings from an object of key/value pairs.
$('.selector').scrollMenu({
key: value,
key: value
});
Selector: Element to add the scroll class
Default: $(this)
String: Class added to the element when scroll up
Default: is-visible
String: Class added to the element when scroll down
Default: is-hidden
String: Class added to the element when scroll reaches top
Default: is-top
String: Class added to the element when scroll reaches bottom
Default: is-bottom
String: Class added to the element when is in the offset
Default: is-offset-in
String: Class added to the element when is out of the offset
Default: is-offset-out
Integer: Delay scroll time out
Default: 1000/60
Integer: Scroll up delta
Default: 0
Integer: Scroll down delta
Default: 0
Integer: Scroll offset
Default: $(this).outerHeight()
Function: Callback that fires on scroll up
Default: function() {}
Function: Callback that fires on scroll down
Default: function() {}
Function: Callback that fires when scroll reaches top
Default: function() {}
Function: Callback that fires when scroll reaches bottom
Default: function() {}
Function: Callback that fires when scroll is in offset
Default: function() {}
Function: Callback that fires when scroll is out of offset
Default: function() {}
These event hooks fire at the same time as their corresponding callbacks (ie. onScrollMenuUp & onScrollMenuDown)
onScrollMenuUp
: This event is triggered on scroll down
onScrollMenuDown
: This event is triggered on scroll up
onScrollMenuTop
: This event is triggered when scroll reaches top
onScrollMenuBottom
: This event is triggered when scroll reaches bottom
onScrollMenuOffsetIn
: This event is triggered when scroll is in offset
onScrollMenuOffsetOut
: This event is triggered when scroll is out of offset
$( document ).on( 'onScrollMenuDown', function() {
// Your code here
});
Copyright (c) 2017 Fabio Quarantini