!function(o){"use strict";o.fn.jsticky=function(t){var s={item_offset:".jeg_header",wrapper:".jeg_navbar_wrapper",state_class:".jeg_sticky_nav",mode:"scroll",use_translate3d:!0,onScrollDown:!1,onScrollUp:!1,onStickyRemoved:!1,broadcast_position:!1};return t=t?o.extend(s,t):o.extend(s),o(this).each((function(){var s,n=1==jnewsoption.admin_bar?32:0,e=0,a=0,i=0,r=o(this),l=r.outerHeight(),c=0,d=0,p=0,f=function(){1==jnewsoption.admin_bar&&(n=o(window).width()<=782&&o(window).width()>600?46:o(window).width()<=600?0:32),s=o(".sticky_blankspace").offset().top};f();o(window).on("scroll",(function(){if("normal"!==t.mode){if(d=o(this).scrollTop(),p=Math.abs(d-a),r.hasClass(t.state_class)||r.addClass("notransition"),d>a){if("scroll"===t.mode){if(d<s+l)return}else if(d<s-n)return;r.addClass(t.state_class),"scroll"===t.mode?(c=i-p)<-l&&(c=-l):"pinned"===t.mode&&p>5&&d>l+n&&(c=-l),"function"==typeof t.onScrollDown&&t.onScrollDown()}else d>s-n?(r.removeClass("notransition"),"scroll"===t.mode&&(c=i+p),("pinned"===t.mode&&p>5||c>0)&&(c=0,r.removeClass("notransition"))):(r.removeClass(t.state_class),c=0,"function"==typeof t.onStickyRemoved&&t.onStickyRemoved()),"function"==typeof t.onScrollUp&&t.onScrollUp();e=d<s-n?0:c+n,r.hasClass(t.state_class)?t.use_translate3d?r.css({"-webkit-transform":"translate3d(0px, "+e+"px, 0px)",transform:"translate3d(0px, "+e+"px, 0px)","--offset":"translate3d(0px, "+n+"px, 0px)"}):r.css({top:e+"px"}):t.use_translate3d?r.css({"-webkit-transform":"",transform:""}):r.css({top:""}),t.broadcast_position&&o(window).trigger("jnews_additional_sticky_margin",l+e),i=c,a=d}})),o(window).on("load resize",(function(){setTimeout(f,200)})),o(document).on("ready",f)}))}}(jQuery);