js monitor web page and scroll down event, a navigation bar automatically show or hide

/ ** 
* page and scroll down event
* @param e
* /
// 0 is hidden, a display
var S = 1;

function scrollFunc (e) {
// e presence does not exist on the use of e with windon.event
e = the window.event || E;
// first determine what browser
iF (e.wheelDelta) {
// browser IE, Google
iF (e.wheelDelta> 0) {
// when scrolling up when the pulley
// console.log ( "scroll up pulley");
IF (S == 0) {
// slide down
$ ( "Div2.") slideDown ( "SLOW");.
S =. 1;
}
}
IF (e.wheelDelta <0) {
// when scrolling down pulley
// the console.log ( "scroll down pulley");
IF (S ==. 1) {
// slid up
$ ( "Div2.") slideUp ( "SLOW");.
S = 0;
}
}
} the else IF (e.detail) {
// browser Firefox
IF (e.detail> 0) {
// when the pulley scroll up when
// console.log ( "scroll up pulley");
IF (S == 0) {
// slide down
$ ( "Div2.") slideDown ( "SLOW");.
S =. 1;
}
}
IF ( e.detail <0) {
// when scrolling down pulley
// console.log ( "scroll down pulley");
iF (S ==. 1) {
// slide upward
$ ( "div2.") slideUp . ( "slow");
s = 0;
}
}
}
}

// bind to the page scroll wheel event
IF (document.addEventListener) {
// Firefox browser
document.addEventListener ( 'DOMMouseScroll', scrollFunc, false);
}
// IE browser Google
window.onmousewheel = document. onmousewheel = scrollFunc;

Guess you like

Origin www.cnblogs.com/c2g5201314/p/11689477.html