Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** JS hack for header autohide on scroll for Jupiter WP theme - v0.3 - by rAthus **/
- jQuery(document).ready(function($)
- {
- var headerHeight = $('header').attr('data-height')*1;
- var mouseWheelEvt = (/Firefox/i.test(navigator.userAgent))?'DOMMouseScroll':'mousewheel';
- $(document).bind(mouseWheelEvt,function(e)
- {
- var evt = window.event||e;
- evt = evt.originalEvent?evt.originalEvent:evt;
- var delta = evt.detail?evt.detail*(-40):evt.wheelDelta;
- if (delta>0)
- $('header .mk-header-holder').stop(true).animate({'top':'0px'},100,'linear');
- else
- $('header .mk-header-holder').stop(true).animate({'top':'-'+headerHeight+'px'},100,'linear');
- });
- $(document).on('scroll',function(e)
- {
- if ($(window).scrollTop()*1+$(window).height()*1>$(document).height()*1-10)
- $('header .mk-header-holder').stop(true).animate({'top':'0px'},100,'linear');
- });
- });
Add Comment
Please, Sign In to add comment