Created
July 3, 2019 14:07
-
-
Save Longkt/36cfc16b8b355265a06894e811e9c4d4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function(t){var e,s,a,i,c,o=t(document),r=t("#masthead"),d=0;function n(){if(s=e.height(),t("#page-cover").css("padding-top",""),t("body").hasClass("is-header-transparent")){var a=t("#page-cover").css("padding-top");a=parseInt(a),(isNaN(a)||a<=0)&&t("#page-cover").css("padding-top",s)}else t("#page-cover").css("padding-top","")}function h(){n(),r.removeAttr("style"),r.css("min-height","auto"),r.length?(s=r.height(),r.css({"min-height":s,display:"block"}),a=r.offset()):a={top:0,left:0},n();var i=0;t("#wpadminbar").length&&(i=t("#wpadminbar").height()),e.css("top",i)}e=t("#masthead-inner"),r=t("#masthead"),n(),h();var y=function(o){void 0===o&&(o=t(window).scrollTop()),"object"!=typeof a&&(a={top:0,left:0});var d=a.top+s+100;if(o>0){var n=0;t("#wpadminbar").length&&(n=t("#wpadminbar").height(),"absolute"==t("#wpadminbar").css("position")&&(n=0)),r.removeClass("sticky-hiding"),r.addClass("sticky"),e.css("top",n),c&&(clearTimeout(c),c=!1),r.hasClass("sticky-active")||i||(t(".header--sticky",r).each(function(){t(this).hasClass("header--transparent")&&t(this).removeClass("header--transparent").attr("data-ht",1)}),i=setTimeout(function(){r.addClass("sticky-active"),t(document.body).trigger("customify_sticky_active"),i=!1},50))}else i&&(clearTimeout(i),i=!1),clearTimeout(c),o>=a.top+s&&o<=d?(r.addClass("sticky-hiding"),c=setTimeout(function(){r.css("top",""),r.removeClass("sticky sticky-active sticky-hiding"),t(document.body).trigger("customify_sticky_active"),t(".header--sticky",r).each(function(){(t(this).attr("data-ht")||!1)&&t(this).addClass("header--transparent")})},300)):(clearTimeout(c),c=!1,e.css("top",""),r.removeClass("sticky sticky-active sticky-hiding"),t(document.body).trigger("customify_sticky_active"),t(".header--sticky",r).each(function(){(t(this).attr("data-ht")||!1)&&t(this).addClass("header--transparent")}))},u=function(o,d){void 0===d&&(d="down");var n=a.top+s+100;if(o>0){var h=0;t("#wpadminbar").length&&(h=t("#wpadminbar").height(),"absolute"==t("#wpadminbar").css("position")&&(h=0)),r.removeClass("sticky-hiding"),r.addClass("sticky"),e.css("top",h),"up"===d?r.hasClass("sticky-active")||i||(i=setTimeout(function(){r.addClass("sticky-active"),i=!1,t(document.body).trigger("customify_sticky_active")},300)):(i&&(clearTimeout(i),i=!1),r.addClass("sticky-hiding"),c=setTimeout(function(){r.css("top",""),r.removeClass("sticky sticky-active sticky-hiding"),t(document.body).trigger("customify_sticky_active"),t(".header--sticky",r).each(function(){(t(this).attr("data-ht")||!1)&&t(this).addClass("header--transparent")})},300))}else i&&(clearTimeout(i),i=!1),clearTimeout(c),o>=a.top+s&&o<=n?(r.addClass("sticky-hiding"),c=setTimeout(function(){e.css("top",""),r.removeClass("sticky sticky-active sticky-hiding"),t(document.body).trigger("customify_sticky_active"),t(".header--sticky",r).each(function(){(t(this).attr("data-ht")||!1)&&t(this).addClass("header--transparent")})},300)):(clearTimeout(c),c=!1,e.css("top",""),r.removeClass("sticky sticky-active sticky-hiding"),t(document.body).trigger("customify_sticky_active"),t(".header--sticky",r).each(function(){(t(this).attr("data-ht")||!1)&&t(this).addClass("header--transparent")}))};o.on("selective-refresh-content-rendered after_auto_render_css",function(e,s,a){try{if(void 0===a&&(a=""),"customify_customize_render_header"===s&&(t("#masthead .header--row.header--transparent").length>0?t("body").addClass("is-header-transparent"):t("body").removeClass("is-header-transparent")),"after_auto_render_css"===s&&"header_cover_padding_top"===a)return void n();h();var i=o.scrollTop();"1"===Customify_Pro_JS.header_sticky_up||1==Customify_Pro_JS.header_sticky_up?u(i,"down"):y(i),o.scroll()}catch(t){}}),t(window).resize(function(){setTimeout(function(){h();var t=o.scrollTop();"1"===Customify_Pro_JS.header_sticky_up?u(t,"down"):y(t),d=t},50)}),console.log("Customify_Pro_JS.header_sticky_up",Customify_Pro_JS.header_sticky_up),o.scroll(function(){var t=o.scrollTop(),e="";e=t>d?"down":"up","1"===Customify_Pro_JS.header_sticky_up?u(t,e):y(t),d=t})}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment