laipower/wp-content/plugins/gp-premium/menu-plus/functions/js/sticky.min.js

1 line
8.3 KiB
JavaScript
Raw Normal View History

function generateStickyDebounce(s,n,a){var o;return function(){var t=this,e=arguments,i=a&&!o;clearTimeout(o),o=setTimeout(function(){o=null,a||s.apply(t,e)},n),i&&s.apply(t,e)}}!function(z,T,M){function e(t,e){function s(){var t=0<jQuery("#wpadminbar").length&&"fixed"==jQuery("#wpadminbar").css("position")?jQuery("#wpadminbar").outerHeight():0;return"auto"===U.topMargin?parseInt(t+v.css("marginTop")):isNaN(U.topMargin)&&0<U.topMargin.search("px")?parseInt(t+U.topMargin.replace("px","")):isNaN(parseInt(U.topMargin))?0:parseInt(t+U.topMargin)}function n(){H.remove(),v.removeClass(U.fixedClass).css({"max-width":"","margin-top":"","margin-left":"","margin-right":"",position:"",top:"",left:"",right:"",bottom:"",width:"",opacity:"",height:"",overflow:"","-webkit-transform":"","-ms-transform":"",transform:"","-webkit-transition":"","-ms-transition":"",transition:"",visibility:""}).removeClass("sticky-navigation-transition").removeClass("navigation-transition").removeClass("sticky-nav-scrolling-up"),"sticky-navigation"===v.attr("id")&&v.attr("id","site-navigation"),m=h=d=!1,v.trigger("stickUp:unStick")}function a(t){z(H).insertAfter(v).show().addClass(U.fixedClass);var e,i=H.offsetParent();t&&(v.css({position:"absolute"}),e=x.offset().top+x.outerHeight()-i.offset().top-g-parseInt(x.css("paddingBottom"))),v.css({position:"absolute",marginTop:C,bottom:"",left:H.position().left,top:t?e:v.offset().top-i.offset().top-C}),v.trigger("stickUp:holdIt")}function i(t){var e,i;U.disableOn()?(u=u&&!1,U.keepInWrapper&&!x.is(":visible")||(l=z(t.target).scrollTop(),c=r<=l?"down":"up",p=Math.abs(r-l),z(T).outerHeight(),r=l,b=v.offset().top,f=parseInt(v.outerHeight()+C)+parseInt(v.css("marginBottom")),d||m||h||(parseInt(v.outerHeight(!0)),h||m?(S.top=parseInt(H.offset().top),parseInt(v.offset().left)):S.top=parseInt(v.offset().top)),g=parseInt(v.outerHeight())+parseInt(v.css("margin-bottom"))+C,U.keepInWrapper?S.bottom=x.offset().top+x.outerHeight()-parseInt(x.css("paddingBottom")):S.bottom=z(M).outerHeight(),k=v.offset().top+g,I=U.scrollHide?f+U.lazyHeight:U.lazyHeight,"none"!==U.transition&&(w=2*v.outerHeight()),C=null!==U.topMargin?s():0,d&&C!==v.css("margin-top")&&v.css("margin-top",C),(!d&&!h&&l>=S.top-C+I+w||h&&m&&l<=b-C+I)&&(function(){d=!0,"fade"==U.transition&&v.hide(),"slide"!=U.transition&&!U.scrollHide||v.css({height:"0",overflow:"hidden",visibility:"hidden"}),z(H).insertAfter(v).show().addClass(U.fixedClass),z(".gen-sidebar-nav").length&&H.css("height",v.outerHeight()),"left"!=v.css("float")&&"right"!=v.css("float")||(H.css("float",v.css("float")),H.attr("style",H.attr("style")+"width:auto !important")),"slide"==U.transition&&"block"==H.css("display")&&v.css({"-webkit-transform":"translateY(-100%)","-ms-transform":"translateY(-100%)",transform:"translateY(-100%)","-webkit-transition":"transform 300ms ease-in-out","-ms-transition":"transform 300ms ease-in-out",transition:"transform 300ms ease-in-out"}),v.addClass(U.fixedClass),"site-navigation"===v.attr("id")&&v.attr("id","sticky-navigation");var t=-I;v.css({"margin-top":C,position:"fixed",top:t+"px",left:"",right:"",bottom:""}),v.trigger("stickUp:stickIt"),"fade"==U.transition&&v.fadeIn(300),"slide"==U.transition&&v.one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(t){v.css({visibility:"",height:"",overflow:""}),setTimeout(function(){v.css({"-webkit-transform":"translateY(0)","-ms-transform":"translateY(0)",transform:"translateY(0)"})},10)}),U.scrollHide&&v.css({height:"",overflow:"",visibility:""})}(),m=h=!(d=!0)),d&&!h&&l>=S.top-C+I+v.outerHeight()/2&&(H.addClass("sticky-navigation-transition"),v.addClass("sticky-navigation-transition")),U.keepInWrapper&&parseInt(k-C)!==parseInt(S.bottom)&&l>=S.bottom-g+I&&(a(!0),m=h=!(d=!1)),d&&(e=parseInt(v.css("top")),"up"===c&&0!==e?(i=-e<p?0:e+p,v.css("top",i+"px"),v.addClass("sticky-nav-scrolling-up")):"down"===c&&-I<e&&(i=I+e<p?-I:e-p,v.css("top",i+"px"),v.removeClass("sticky-nav-scrolling-up"))),(d||m||h)&&l<=S.top-C&&n(),(d||m||h)&&H&&H.width()!==v.outerWidth()&&v.outerWidth(H.outerWidth()))):