File "mad.sticky-header-section.min.js"

Full Path: /var/www/vhosts/hogsandbbqs.co.uk/httpdocs/DataTables/helpers/mad.sticky-header-section.min.js
File size: 4.04 KB
MIME-type: text/plain
Charset: utf-8

var MadStickyHeaderSection=function(d){function b(c,a){this.$element=c;this.config=d.extend(!0,{},f,a||{});this.updateDocumentState();Object.defineProperties(this,{activeClass:{get:function(){return this.config.cssPrefix+this.config.classMap.active}},sticked:{get:function(){return this.$element.hasClass(this.activeClass)}},$hiddenSections:{get:function(){return this.$element.find("."+this.config.cssPrefix+this.config.classMap.hiddenSection)}},isSuitable:{get:function(){var a=d(window);return this.$element.hasClass(this.config.cssPrefix+
"header-section--sticky-xs")&&a.width()>this.config.breakpointMap.xs||this.$element.hasClass(this.config.cssPrefix+"header-section--sticky-sm")&&a.width()>this.config.breakpointMap.sm||this.$element.hasClass(this.config.cssPrefix+"header-section--sticky-md")&&a.width()>this.config.breakpointMap.md||this.$element.hasClass(this.config.cssPrefix+"header-section--sticky-lg")&&a.width()>this.config.breakpointMap.lg||this.$element.hasClass(this.config.cssPrefix+"header-section--sticky-xl")&&a.width()>this.config.breakpointMap.xl||
this.$element.hasClass(this.config.cssPrefix+"header-section--sticky-xxl")&&a.width()>this.config.breakpointMap.xxl||this.$element.hasClass(this.config.cssPrefix+"header-section--sticky-xxxl")&&a.width()>this.config.breakpointMap.xxxl}},$container:{get:function(){return this.$element.closest("."+this.config.cssPrefix+this.config.classMap.container)}},spaceExceptionClass:{get:function(){return this.config.cssPrefix+this.config.classMap.spaceException}},exceptionForSpaceExceptionClass:{get:function(){return this.config.cssPrefix+
this.config.classMap.exceptionForSpaceException}}});this._bindEvents()}if(d){var f={cssPrefix:"mad-",resizeDelay:50,classMap:{hiddenSection:"header-section--sticky-hidden",active:"header-section--sticked",container:"header",spaceException:"header--transparent",exceptionForSpaceException:"header--breadcrumb-part"},breakpointMap:{xs:0,sm:576,md:768,lg:992,xl:1200,xxl:1380,xxxl:1600},animationDuration:400,animationEasing:"linear"},e=d("body");b.prototype.updateDocumentState=function(){this.topOffset=
this.$element.offset().top;this.defaultBodyPadding=parseInt(e.css("padding-top"),10);return this};b.prototype.sticky=function(){this.$element.addClass(this.activeClass);this._addSpace().hideSections();return this};b.prototype.unsticky=function(){this.$element.removeClass(this.activeClass);this._removeSpace().showSections();return this};b.prototype._addSpace=function(){this.$container.hasClass(this.spaceExceptionClass)&&!this.$container.hasClass(this.exceptionForSpaceExceptionClass)||e.css("padding-top",
this.defaultBodyPadding+this.$element.outerHeight()).trigger("spaceadded.milenia.stickysection");return this};b.prototype._removeSpace=function(){this.$container.hasClass(this.spaceExceptionClass)&&!this.$container.hasClass(this.exceptionForSpaceExceptionClass)||e.css("padding-top",this.defaultBodyPadding).trigger("spaceremoved.milenia.stickysection");return this};b.prototype.hideSections=function(){var c=this;this.$hiddenSections.length&&this.$hiddenSections.stop().slideUp({easing:c.config.animationEasing,
duration:c.config.animationDuration,step:function(){c._addSpace()},complete:function(){d(this).css("height","")}});return this.$hiddenSections};b.prototype.showSections=function(){this.$hiddenSections.length&&this.$hiddenSections.stop().slideDown({easing:this.config.animationEasing,duration:this.config.animationDuration,complete:function(){d(this).css("height","")}});return this.$hiddenSections};b.prototype._bindEvents=function(){var c=d(window),a=this;c.on("scroll.MadStickyHeaderSection",function(b){c.scrollTop()>
a.topOffset&&!a.sticked&&a.isSuitable?a.sticky():c.scrollTop()<=a.topOffset&&a.sticked&&a.isSuitable&&a.unsticky()}).on("resize.MadStickyHeaderSection",function(b){a.resizeTimeOutId&&clearTimeout(a.resizeTimeOutId);a.resizeTimeOutId=setTimeout(function(){a.unsticky().updateDocumentState();c.scrollTop()>a.topOffset&&!a.sticked&&a.isSuitable&&a.sticky();a.isSuitable||a.showSections()},a.config.resizeDelay)}).trigger("scroll.MadStickyHeaderSection")};return b}}(window.jQuery);