From d52999619f5b91eb6ddb0d79e624e150b9bb5bf5 Mon Sep 17 00:00:00 2001 From: Siarhei Khilko Date: Tue, 7 Apr 2015 21:26:45 -0700 Subject: [PATCH] Attach global reference on window `StickyHeader` reference is lost after minification. Adding it explicitly to fix minification. --- demo/styles/demo.scss | 4 ++-- dist/maps/stickyheaders.jquery.min.js.map | 2 +- dist/maps/stickyheaders.min.js.map | 2 +- dist/scripts/stickyheaders.jquery.js | 2 ++ dist/scripts/stickyheaders.jquery.min.js | 2 +- dist/scripts/stickyheaders.js | 2 ++ dist/scripts/stickyheaders.min.js | 2 +- src/scripts/main.js | 2 ++ 8 files changed, 12 insertions(+), 6 deletions(-) diff --git a/demo/styles/demo.scss b/demo/styles/demo.scss index ea87ebd..94f6704 100644 --- a/demo/styles/demo.scss +++ b/demo/styles/demo.scss @@ -59,7 +59,7 @@ footer { .list-view-header { border-bottom: 1px solid hsl(0, 0%, 80%); - background-color: hsl(0, 0, 87%); + background-color: hsl(0, 0%, 87%); transition: background 300ms; } @@ -76,7 +76,7 @@ footer { .list-view-item { border-bottom: 1px solid hsl(0, 0%, 87%); - background-color: hsl(0, 0, 100%); + background-color: hsl(0, 0%, 100%); } diff --git a/dist/maps/stickyheaders.jquery.min.js.map b/dist/maps/stickyheaders.jquery.min.js.map index cb71d38..3f9e55a 100644 --- a/dist/maps/stickyheaders.jquery.min.js.map +++ b/dist/maps/stickyheaders.jquery.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["main.js","jquery-plugin.js"],"names":["$","window","document","undefined","StickyHeaders","el","options","this","element","stuckHeadersHeight","_updating","_readListStyles","headers","Array","prototype","map","call","querySelectorAll","headerSelector","header","i","clientRect","getBoundingClientRect","clone","cloneNode","classList","add","style","height","headerContainerHeight","dataset","index","top","_listStyles","bind","_createHeaderContainer","addEventListener","onScroll","Plugin","init","SCROLL_WIDTH","scrollDiv","createElement","className","body","appendChild","scrollbarWidth","offsetWidth","clientWidth","removeChild","SCROLL_STEP_DEFAULT","LINE_HEIGHT","borderTopWidth","clientTop","borderLeftWidth","clientLeft","headerWrap","listBorderLeftWidth","left","right","headerContainer","onHeaderActivate","onHeaderScroll","parentNode","insertBefore","ev","target","contains","parseInt","targetHeader","scrollTop","_latestKnownScrollTop","_requestUpdate","setTimeout","updateHeaders","shiftAmount","forEach","isWithinHeaderContainer","requestAnimationFrame","containerOffset","transform","scrollDelta","deltaMode","WheelEvent","DOM_DELTA_PIXEL","deltaY","DOM_DELTA_LINE","preventDefault","pluginName","akno","destroy","removeData","fn","args","arguments","dataKey","each","data","instance","isFunction","apply","slice","jQuery"],"mappings":"CAAA,SAAAA,EAAAC,EAAAC,EAAAC,GACA,YAuBA,SAAAC,GAAAC,EAAAC,GACAC,KAAAC,QAAAH,EACAE,KAAAD,QAAAA,EACAC,KAAAE,mBAAA,EACAF,KAAAG,WAAA,EAEAH,KAAAI,kBAGAJ,KAAAK,QAAAC,MAAAC,UAAAC,IAAAC,KAAAX,EAAAY,iBAAAV,KAAAD,QAAAY,gBAAA,SAAAC,EAAAC,GACA,GAAAC,GAAAF,EAAAG,wBAEAC,EAAAJ,EAAAK,WAAA,EASA,OARAD,GAAAE,UAAAC,IAAA,gBAAA,YAGAH,EAAAI,MAAAC,OAAAP,EAAAO,OAAA,KAEArB,KAAAsB,sBAAAR,EAAAO,OAEAL,EAAAO,QAAAC,MAAAX,GAEAY,IAAAX,EAAAW,IAAAzB,KAAA0B,YAAAD,IACAJ,OAAAP,EAAAO,OACAvB,GAAAkB,IAEAW,KAAA3B,OAEAA,KAAA4B,yBAEA9B,EAAA+B,iBAAA,SAAA7B,KAAA8B,SAAAH,KAAA3B,OCpDA,QAAA+B,GAAA9B,EAAAF,GACAC,KAAAC,QAAAA,EACAD,KAAAD,QAAAA,EACAC,KAAAgC,ODFA,GAAAC,GAAA,WACA,GAAAC,GAAAvC,EAAAwC,cAAA,MACAD,GAAAE,UAAA,uBACAzC,EAAA0C,KAAAC,YAAAJ,EACA,IAAAK,GAAAL,EAAAM,YA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4F,GAAAJ,GAAA,SAAAlF,GACA,GAAAuF,GAAAC,UACAC,EAAA,UAAAP,CACA,OAAAlF,KAAAH,GAAA,gBAAAG,GACAC,KAAAyF,KAAA,WACAhG,EAAAiG,KAAA1F,KAAAwF,IACA/F,EAAAiG,KAAA1F,KAAAwF,EAAA,GAAAzD,GAAA/B,KAAAD,MAGA,gBAAAA,IAAA,MAAAA,EAAA,IAAA,SAAAA,EACAC,KAAAyF,KAAA,WACA,GAAAE,GAAAlG,EAAAiG,KAAA1F,KAAAwF,EACAG,aAAA5D,MAEAtC,EAAAmG,WAAAD,EAAA5F,KAAAN,EAAAmG,WAAAD,EAAAT,KAAAnF,MACA4F,EAAAA,EAAAT,MAEAS,EAAA5F,GAAA8F,MAAAF,EAAArF,MAAAC,UAAAuF,MAAArF,KAAA6E,EAAA,OARA,SAaAS,OAAArG,OAAAA,OAAAC","file":"stickyheaders.jquery.min.js","sourcesContent":["/* global WheelEvent */\n'use strict';\n\nvar SCROLL_WIDTH = (function() {\n var scrollDiv = document.createElement('div');\n scrollDiv.className = 'js-scrollbar-measure';\n document.body.appendChild(scrollDiv);\n var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;\n document.body.removeChild(scrollDiv);\n return scrollbarWidth;\n})();\n\nvar SCROLL_STEP_DEFAULT = 50;\nvar LINE_HEIGHT = 16;\n\n/**\n * This plugin enables sticky section headings on a list element.\n *\n * Supported browsers: Chrome, FF, Safari, IE11+\n *\n * @param el - list dom element\n * @param options - an option object. Supports:\n * - headerSelector - a selector string matching header elements\n */\nfunction StickyHeaders(el, options) {\n this.element = el;\n this.options = options;\n this.stuckHeadersHeight = 0;\n this._updating = false;\n\n this._readListStyles();\n\n // this.headers contains clone elements references and cached dimensions for faster scroll handling\n this.headers = Array.prototype.map.call(el.querySelectorAll(this.options.headerSelector), function(header, i) {\n var clientRect = header.getBoundingClientRect();\n\n var clone = header.cloneNode(true);\n clone.classList.add('sticky-header', 'is-stuck');\n // explicitly define the height for the clone, just in case it was applied on the original element\n // via a selector which is no longer affecting the clone\n clone.style.height = clientRect.height + 'px';\n // TODO all clones must be of equal height\n this.headerContainerHeight = clientRect.height;\n\n clone.dataset.index = i;\n return {\n top: clientRect.top - this._listStyles.top,\n height: clientRect.height,\n el: clone\n };\n }.bind(this));\n\n this._createHeaderContainer();\n\n el.addEventListener('scroll', this.onScroll.bind(this));\n}\n\nStickyHeaders.prototype._readListStyles = function() {\n var element = this.element;\n this._listStyles = {\n top: element.getBoundingClientRect().top,\n borderTopWidth: element.clientTop,\n borderLeftWidth: element.clientLeft\n };\n\n};\n\nStickyHeaders.prototype._createHeaderContainer = function() {\n var header = document.createElement('div');\n header.className = 'sticky-container';\n\n var headerWrap = document.createElement('div');\n var listBorderLeftWidth = this._listStyles.borderLeftWidth;\n headerWrap.className = 'sticky-container-inner';\n headerWrap.style.top = this._listStyles.borderTopWidth + 'px';\n headerWrap.style.left = listBorderLeftWidth + 'px';\n headerWrap.style.right = (SCROLL_WIDTH + listBorderLeftWidth) + 'px';\n headerWrap.style.height = this.headerContainerHeight + 'px';\n header.appendChild(headerWrap);\n\n var headerContainer = this.headerContainer = document.createElement('div');\n headerWrap.appendChild(headerContainer);\n\n header.addEventListener('click', this.onHeaderActivate.bind(this));\n header.addEventListener('wheel', this.onHeaderScroll.bind(this));\n\n this.element.parentNode.insertBefore(header, this.element);\n};\n\nStickyHeaders.prototype.onHeaderActivate = function(ev) {\n if (ev.target.classList.contains('is-stuck')) {\n var index = parseInt(ev.target.dataset.index, 10);\n var targetHeader = this.headers[index];\n this.element.scrollTop = targetHeader.top;\n }\n};\n\nStickyHeaders.prototype.onScroll = function() {\n this._latestKnownScrollTop = this.element.scrollTop;\n this._requestUpdate();\n};\n\nStickyHeaders.prototype._requestUpdate = function() {\n if(!this._updating) {\n setTimeout(this.updateHeaders.bind(this), 0);\n this._updating = true;\n }\n};\n\nStickyHeaders.prototype.updateHeaders = function() {\n var scrollTop = this._latestKnownScrollTop + this._listStyles.borderTopWidth;\n var shiftAmount = 0;\n\n this.headers.forEach(function(header) {\n if (!header.el.parentNode) {\n if (header.top < scrollTop) {\n this.headerContainer.appendChild(header.el);\n this.stuckHeadersHeight += header.height;\n }\n } else {\n if (header.top >= scrollTop) {\n this.headerContainer.removeChild(header.el);\n this.stuckHeadersHeight -= header.height;\n }\n }\n\n if (this.isWithinHeaderContainer(header, scrollTop)) {\n // the distance between the top of the scrollable area and the header top\n // minus the height of the header container gives the shift amount\n // for the stuck headers on in order to have an effect of a 'replacement'\n // of the old header with a new one\n shiftAmount = (header.top - scrollTop) - this.headerContainerHeight;\n }\n }, this);\n\n shiftAmount += this.headerContainerHeight - this.stuckHeadersHeight;\n\n requestAnimationFrame(function(containerOffset) {\n this.headerContainer.style.transform = 'translateY(' + containerOffset + 'px)';\n this._updating = false;\n }.bind(this, shiftAmount));\n};\n\nStickyHeaders.prototype.onHeaderScroll = function(ev) {\n var scrollDelta = 0;\n switch (ev.deltaMode) {\n case WheelEvent.DOM_DELTA_PIXEL:\n scrollDelta = ev.deltaY;\n break;\n case WheelEvent.DOM_DELTA_LINE:\n scrollDelta = LINE_HEIGHT * ev.deltaY;\n break;\n default:\n scrollDelta = SCROLL_STEP_DEFAULT;\n }\n this.element.scrollTop += scrollDelta;\n // prevent the viewport from scrolling\n ev.preventDefault();\n};\n\nStickyHeaders.prototype.isWithinHeaderContainer = function(header, scrollTop) {\n return header.top >= scrollTop && header.top <= this.headerContainerHeight + scrollTop;\n};\n","var pluginName = 'stickyHeaders';\n\nfunction Plugin(element, options) {\n this.element = element;\n this.options = options;\n this.init();\n}\n\nPlugin.prototype.init = function() {\n this.akno = new StickyHeaders(this.element, this.options);\n};\n\nPlugin.prototype.destroy = function() {\n this.akno.destroy();\n $.removeData(this.element, 'plugin_' + pluginName);\n this.element = null;\n};\n\n$.fn[pluginName] = function(options) {\n var args = arguments;\n var dataKey = 'plugin_' + pluginName;\n if (options === undefined || typeof options === 'object') {\n return this.each(function() {\n if (!$.data(this, dataKey)) {\n $.data(this, dataKey, new Plugin(this, options));\n }\n });\n } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {\n return this.each(function() {\n var instance = $.data(this, dataKey);\n if (instance instanceof Plugin) {\n // call with the widget instance if not on the plugin\n if(!$.isFunction(instance[options]) && $.isFunction(instance.akno[options])) {\n instance = instance.akno;\n }\n instance[options].apply(instance, Array.prototype.slice.call(args, 1));\n }\n });\n }\n};\n"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["main.js","jquery-plugin.js"],"names":["$","window","document","undefined","StickyHeaders","el","options","this","element","stuckHeadersHeight","_updating","_readListStyles","headers","Array","prototype","map","call","querySelectorAll","headerSelector","header","i","clientRect","getBoundingClientRect","clone","cloneNode","classList","add","style","height","headerContainerHeight","dataset","index","top","_listStyles","bind","_createHeaderContainer","addEventListener","onScroll","Plugin","init","SCROLL_WIDTH","scrollDiv","createElement","className","body","appendChild","scrollbarWidth","offsetWidth","clientWidth","removeChild","SCROLL_STEP_DEFAULT","LINE_HEIGHT","borderTopWidth","clientTop","borderLeftWidth","clientLeft","headerWrap","listBorderLeftWidth","left","right","headerContainer","onHeaderActivate","onHeaderScroll","parentNode","insertBefore","ev","target","contains","parseInt","targetHeader","scrollTop","_latestKnownScrollTop","_requestUpdate","setTimeout","updateHeaders","shiftAmount","forEach","isWithinHeaderContainer","requestAnimationFrame","containerOffset","transform","scrollDelta","deltaMode","WheelEvent","DOM_DELTA_PIXEL","deltaY","DOM_DELTA_LINE","preventDefault","pluginName","akno","destroy","removeData","fn","args","arguments","dataKey","each","data","instance","isFunction","apply","slice","jQuery"],"mappings":"CAAA,SAAAA,EAAAC,EAAAC,EAAAC,GACA,YAuBA,SAAAC,GAAAC,EAAAC,GACAC,KAAAC,QAAAH,EACAE,KAAAD,QAAAA,EACAC,KAAAE,mBAAA,EACAF,KAAAG,WAAA,EAEAH,KAAAI,kBAGAJ,KAAAK,QAAAC,MAAAC,UAAAC,IAAAC,KAAAX,EAAAY,iB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/* global WheelEvent */\n'use strict';\n\nvar SCROLL_WIDTH = (function() {\n var scrollDiv = document.createElement('div');\n scrollDiv.className = 'js-scrollbar-measure';\n document.body.appendChild(scrollDiv);\n var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;\n document.body.removeChild(scrollDiv);\n return scrollbarWidth;\n})();\n\nvar SCROLL_STEP_DEFAULT = 50;\nvar LINE_HEIGHT = 16;\n\n/**\n * This plugin enables sticky section headings on a list element.\n *\n * Supported browsers: Chrome, FF, Safari, IE11+\n *\n * @param el - list dom element\n * @param options - an option object. Supports:\n * - headerSelector - a selector string matching header elements\n */\nfunction StickyHeaders(el, options) {\n this.element = el;\n this.options = options;\n this.stuckHeadersHeight = 0;\n this._updating = false;\n\n this._readListStyles();\n\n // this.headers contains clone elements references and cached dimensions for faster scroll handling\n this.headers = Array.prototype.map.call(el.querySelectorAll(this.options.headerSelector), function(header, i) {\n var clientRect = header.getBoundingClientRect();\n\n var clone = header.cloneNode(true);\n clone.classList.add('sticky-header', 'is-stuck');\n // explicitly define the height for the clone, just in case it was applied on the original element\n // via a selector which is no longer affecting the clone\n clone.style.height = clientRect.height + 'px';\n // TODO all clones must be of equal height\n this.headerContainerHeight = clientRect.height;\n\n clone.dataset.index = i;\n return {\n top: clientRect.top - this._listStyles.top,\n height: clientRect.height,\n el: clone\n };\n }.bind(this));\n\n this._createHeaderContainer();\n\n el.addEventListener('scroll', this.onScroll.bind(this));\n}\n\nStickyHeaders.prototype._readListStyles = function() {\n var element = this.element;\n this._listStyles = {\n top: element.getBoundingClientRect().top,\n borderTopWidth: element.clientTop,\n borderLeftWidth: element.clientLeft\n };\n\n};\n\nStickyHeaders.prototype._createHeaderContainer = function() {\n var header = document.createElement('div');\n header.className = 'sticky-container';\n\n var headerWrap = document.createElement('div');\n var listBorderLeftWidth = this._listStyles.borderLeftWidth;\n headerWrap.className = 'sticky-container-inner';\n headerWrap.style.top = this._listStyles.borderTopWidth + 'px';\n headerWrap.style.left = listBorderLeftWidth + 'px';\n headerWrap.style.right = (SCROLL_WIDTH + listBorderLeftWidth) + 'px';\n headerWrap.style.height = this.headerContainerHeight + 'px';\n header.appendChild(headerWrap);\n\n var headerContainer = this.headerContainer = document.createElement('div');\n headerWrap.appendChild(headerContainer);\n\n header.addEventListener('click', this.onHeaderActivate.bind(this));\n header.addEventListener('wheel', this.onHeaderScroll.bind(this));\n\n this.element.parentNode.insertBefore(header, this.element);\n};\n\nStickyHeaders.prototype.onHeaderActivate = function(ev) {\n if (ev.target.classList.contains('is-stuck')) {\n var index = parseInt(ev.target.dataset.index, 10);\n var targetHeader = this.headers[index];\n this.element.scrollTop = targetHeader.top;\n }\n};\n\nStickyHeaders.prototype.onScroll = function() {\n this._latestKnownScrollTop = this.element.scrollTop;\n this._requestUpdate();\n};\n\nStickyHeaders.prototype._requestUpdate = function() {\n if(!this._updating) {\n setTimeout(this.updateHeaders.bind(this), 0);\n this._updating = true;\n }\n};\n\nStickyHeaders.prototype.updateHeaders = function() {\n var scrollTop = this._latestKnownScrollTop + this._listStyles.borderTopWidth;\n var shiftAmount = 0;\n\n this.headers.forEach(function(header) {\n if (!header.el.parentNode) {\n if (header.top < scrollTop) {\n this.headerContainer.appendChild(header.el);\n this.stuckHeadersHeight += header.height;\n }\n } else {\n if (header.top >= scrollTop) {\n this.headerContainer.removeChild(header.el);\n this.stuckHeadersHeight -= header.height;\n }\n }\n\n if (this.isWithinHeaderContainer(header, scrollTop)) {\n // the distance between the top of the scrollable area and the header top\n // minus the height of the header container gives the shift amount\n // for the stuck headers on in order to have an effect of a 'replacement'\n // of the old header with a new one\n shiftAmount = (header.top - scrollTop) - this.headerContainerHeight;\n }\n }, this);\n\n shiftAmount += this.headerContainerHeight - this.stuckHeadersHeight;\n\n requestAnimationFrame(function(containerOffset) {\n this.headerContainer.style.transform = 'translateY(' + containerOffset + 'px)';\n this._updating = false;\n }.bind(this, shiftAmount));\n};\n\nStickyHeaders.prototype.onHeaderScroll = function(ev) {\n var scrollDelta = 0;\n switch (ev.deltaMode) {\n case WheelEvent.DOM_DELTA_PIXEL:\n scrollDelta = ev.deltaY;\n break;\n case WheelEvent.DOM_DELTA_LINE:\n scrollDelta = LINE_HEIGHT * ev.deltaY;\n break;\n default:\n scrollDelta = SCROLL_STEP_DEFAULT;\n }\n this.element.scrollTop += scrollDelta;\n // prevent the viewport from scrolling\n ev.preventDefault();\n};\n\nStickyHeaders.prototype.isWithinHeaderContainer = function(header, scrollTop) {\n return header.top >= scrollTop && header.top <= this.headerContainerHeight + scrollTop;\n};\n\nwindow.StickyHeaders = StickyHeaders;\n","var pluginName = 'stickyHeaders';\n\nfunction Plugin(element, options) {\n this.element = element;\n this.options = options;\n this.init();\n}\n\nPlugin.prototype.init = function() {\n this.akno = new StickyHeaders(this.element, this.options);\n};\n\nPlugin.prototype.destroy = function() {\n this.akno.destroy();\n $.removeData(this.element, 'plugin_' + pluginName);\n this.element = null;\n};\n\n$.fn[pluginName] = function(options) {\n var args = arguments;\n var dataKey = 'plugin_' + pluginName;\n if (options === undefined || typeof options === 'object') {\n return this.each(function() {\n if (!$.data(this, dataKey)) {\n $.data(this, dataKey, new Plugin(this, options));\n }\n });\n } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {\n return this.each(function() {\n var instance = $.data(this, dataKey);\n if (instance instanceof Plugin) {\n // call with the widget instance if not on the plugin\n if(!$.isFunction(instance[options]) && $.isFunction(instance.akno[options])) {\n instance = instance.akno;\n }\n instance[options].apply(instance, Array.prototype.slice.call(args, 1));\n }\n });\n }\n};\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/dist/maps/stickyheaders.min.js.map b/dist/maps/stickyheaders.min.js.map index 2a331b3..c8a4f8e 100644 --- a/dist/maps/stickyheaders.min.js.map +++ b/dist/maps/stickyheaders.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["stickyheaders.js"],"names":["window","document","StickyHeaders","el","options","this","element","stuckHeadersHeight","_updating","_readListStyles","headers","Array","prototype","map","call","querySelectorAll","headerSelector","header","i","clientRect","getBoundingClientRect","clone","cloneNode","classList","add","style","height","headerContainerHeight","dataset","index","top","_listStyles","bind","_createHeaderContainer","addEventListener","onScroll","SCROLL_WIDTH","scrollDiv","createElement","className","body","appendChild","scrollbarWidth","offsetWidth","clientWidth","removeChild","SCROLL_STEP_DEFAULT","LINE_HEIGHT","borderTopWidth","clientTop","borderLeftWidth","clientLeft","headerWrap","listBorderLeftWidth","left","right","headerContainer","onHeaderActivate","onHeaderScroll","parentNode","insertBefore","ev","target","contains","parseInt","targetHeader","scrollTop","_latestKnownScrollTop","_requestUpdate","setTimeout","updateHeaders","shiftAmount","forEach","isWithinHeaderContainer","requestAnimationFrame","containerOffset","transform","scrollDelta","deltaMode","WheelEvent","DOM_DELTA_PIXEL","deltaY","DOM_DELTA_LINE","preventDefault"],"mappings":"CAAC,SAAUA,EAAQC,GACnB,YAuBA,SAASC,GAAcC,EAAIC,GACvBC,KAAKC,QAAUH,EACfE,KAAKD,QAAUA,EACfC,KAAKE,mBAAqB,EAC1BF,KAAKG,WAAY,EAEjBH,KAAKI,kBAGLJ,KAAKK,QAAUC,MAAMC,UAAUC,IAAIC,KAAKX,EAAGY,iBAAiBV,KAAKD,QAAQY,gBAAiB,SAASC,EAAQC,GACvG,GAAIC,GAAaF,EAAOG,wBAEpBC,EAAQJ,EAAOK,WAAU,EAS7B,OARAD,GAAME,UAAUC,IAAI,gBAAiB,YAGrCH,EAAMI,MAAMC,OAASP,EAAWO,OAAS,KAEzCrB,KAAKsB,sBAAwBR,EAAWO,OAExCL,EAAMO,QAAQC,MAAQX,GAElBY,IAAKX,EAAWW,IAAMzB,KAAK0B,YAAYD,IACvCJ,OAAQP,EAAWO,OACnBvB,GAAIkB,IAEVW,KAAK3B,OAEPA,KAAK4B,yBAEL9B,EAAG+B,iBAAiB,SAAU7B,KAAK8B,SAASH,KAAK3B,OAnDrD,GAAI+B,GAAe,WACf,GAAIC,GAAYpC,EAASqC,cAAc,MACvCD,GAAUE,UAA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window, document, undefined) {/* global WheelEvent */\n'use strict';\n\nvar SCROLL_WIDTH = (function() {\n var scrollDiv = document.createElement('div');\n scrollDiv.className = 'js-scrollbar-measure';\n document.body.appendChild(scrollDiv);\n var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;\n document.body.removeChild(scrollDiv);\n return scrollbarWidth;\n})();\n\nvar SCROLL_STEP_DEFAULT = 50;\nvar LINE_HEIGHT = 16;\n\n/**\n * This plugin enables sticky section headings on a list element.\n *\n * Supported browsers: Chrome, FF, Safari, IE11+\n *\n * @param el - list dom element\n * @param options - an option object. Supports:\n * - headerSelector - a selector string matching header elements\n */\nfunction StickyHeaders(el, options) {\n this.element = el;\n this.options = options;\n this.stuckHeadersHeight = 0;\n this._updating = false;\n\n this._readListStyles();\n\n // this.headers contains clone elements references and cached dimensions for faster scroll handling\n this.headers = Array.prototype.map.call(el.querySelectorAll(this.options.headerSelector), function(header, i) {\n var clientRect = header.getBoundingClientRect();\n\n var clone = header.cloneNode(true);\n clone.classList.add('sticky-header', 'is-stuck');\n // explicitly define the height for the clone, just in case it was applied on the original element\n // via a selector which is no longer affecting the clone\n clone.style.height = clientRect.height + 'px';\n // TODO all clones must be of equal height\n this.headerContainerHeight = clientRect.height;\n\n clone.dataset.index = i;\n return {\n top: clientRect.top - this._listStyles.top,\n height: clientRect.height,\n el: clone\n };\n }.bind(this));\n\n this._createHeaderContainer();\n\n el.addEventListener('scroll', this.onScroll.bind(this));\n}\n\nStickyHeaders.prototype._readListStyles = function() {\n var element = this.element;\n this._listStyles = {\n top: element.getBoundingClientRect().top,\n borderTopWidth: element.clientTop,\n borderLeftWidth: element.clientLeft\n };\n\n};\n\nStickyHeaders.prototype._createHeaderContainer = function() {\n var header = document.createElement('div');\n header.className = 'sticky-container';\n\n var headerWrap = document.createElement('div');\n var listBorderLeftWidth = this._listStyles.borderLeftWidth;\n headerWrap.className = 'sticky-container-inner';\n headerWrap.style.top = this._listStyles.borderTopWidth + 'px';\n headerWrap.style.left = listBorderLeftWidth + 'px';\n headerWrap.style.right = (SCROLL_WIDTH + listBorderLeftWidth) + 'px';\n headerWrap.style.height = this.headerContainerHeight + 'px';\n header.appendChild(headerWrap);\n\n var headerContainer = this.headerContainer = document.createElement('div');\n headerWrap.appendChild(headerContainer);\n\n header.addEventListener('click', this.onHeaderActivate.bind(this));\n header.addEventListener('wheel', this.onHeaderScroll.bind(this));\n\n this.element.parentNode.insertBefore(header, this.element);\n};\n\nStickyHeaders.prototype.onHeaderActivate = function(ev) {\n if (ev.target.classList.contains('is-stuck')) {\n var index = parseInt(ev.target.dataset.index, 10);\n var targetHeader = this.headers[index];\n this.element.scrollTop = targetHeader.top;\n }\n};\n\nStickyHeaders.prototype.onScroll = function() {\n this._latestKnownScrollTop = this.element.scrollTop;\n this._requestUpdate();\n};\n\nStickyHeaders.prototype._requestUpdate = function() {\n if(!this._updating) {\n setTimeout(this.updateHeaders.bind(this), 0);\n this._updating = true;\n }\n};\n\nStickyHeaders.prototype.updateHeaders = function() {\n var scrollTop = this._latestKnownScrollTop + this._listStyles.borderTopWidth;\n var shiftAmount = 0;\n\n this.headers.forEach(function(header) {\n if (!header.el.parentNode) {\n if (header.top < scrollTop) {\n this.headerContainer.appendChild(header.el);\n this.stuckHeadersHeight += header.height;\n }\n } else {\n if (header.top >= scrollTop) {\n this.headerContainer.removeChild(header.el);\n this.stuckHeadersHeight -= header.height;\n }\n }\n\n if (this.isWithinHeaderContainer(header, scrollTop)) {\n // the distance between the top of the scrollable area and the header top\n // minus the height of the header container gives the shift amount\n // for the stuck headers on in order to have an effect of a 'replacement'\n // of the old header with a new one\n shiftAmount = (header.top - scrollTop) - this.headerContainerHeight;\n }\n }, this);\n\n shiftAmount += this.headerContainerHeight - this.stuckHeadersHeight;\n\n requestAnimationFrame(function(containerOffset) {\n this.headerContainer.style.transform = 'translateY(' + containerOffset + 'px)';\n this._updating = false;\n }.bind(this, shiftAmount));\n};\n\nStickyHeaders.prototype.onHeaderScroll = function(ev) {\n var scrollDelta = 0;\n switch (ev.deltaMode) {\n case WheelEvent.DOM_DELTA_PIXEL:\n scrollDelta = ev.deltaY;\n break;\n case WheelEvent.DOM_DELTA_LINE:\n scrollDelta = LINE_HEIGHT * ev.deltaY;\n break;\n default:\n scrollDelta = SCROLL_STEP_DEFAULT;\n }\n this.element.scrollTop += scrollDelta;\n // prevent the viewport from scrolling\n ev.preventDefault();\n};\n\nStickyHeaders.prototype.isWithinHeaderContainer = function(header, scrollTop) {\n return header.top >= scrollTop && header.top <= this.headerContainerHeight + scrollTop;\n};\n})(window, window.document);"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["stickyheaders.js"],"names":["window","document","StickyHeaders","el","options","this","element","stuckHeadersHeight","_updating","_readListStyles","headers","Array","prototype","map","call","querySelectorAll","headerSelector","header","i","clientRect","getBoundingClientRect","clone","cloneNode","classList","add","style","height","headerContainerHeight","dataset","index","top","_listStyles","bind","_createHeaderContainer","addEventListener","onScroll","SCROLL_WIDTH","scrollDiv","createElement","className","body","appendChild","scrollbarWidth","offsetWidth","clientWidth","removeChild","SCROLL_STEP_DEFAULT","LINE_HEIGHT","borderTopWidth","clientTop","borderLeftWidth","clientLeft","headerWrap","listBorderLeftWidth","left","right","headerContainer","onHeaderActivate","onHeaderScroll","parentNode","insertBefore","ev","target","contains","parseInt","targetHeader","scrollTop","_latestKnownScrollTop","_requestUpdate","setTimeout","updateHeaders","shiftAmount","forEach","isWithinHeaderContainer","requestAnimationFrame","containerOffset","transform","scrollDelta","deltaMode","WheelEvent","DOM_DELTA_PIXEL","deltaY","DOM_DELTA_LINE","preventDefault"],"mappings":"CAAC,SAAUA,EAAQC,GACnB,YAuBA,SAASC,GAAcC,EAAIC,GACvBC,KAAKC,QAAUH,EACfE,KAAKD,QAAUA,EACfC,KAAKE,mBAAqB,EAC1BF,KAAKG,WAAY,EAEjBH,KAAKI,kBAGLJ,KAAKK,QAAUC,MAAMC,UAAUC,IAAIC,KAAKX,EAAGY,iBAAi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EAAkB,MACzEtE,KAAKG,WAAY,GACnBwB,KAAK3B,KAAMkE,KAGjBrE,EAAcU,UAAU8C,eAAiB,SAASG,GAC9C,GAAIgB,GAAc,CAClB,QAAQhB,EAAGiB,WACP,IAAKC,YAAWC,gBACZH,EAAchB,EAAGoB,MACjB,MACJ,KAAKF,YAAWG,eACZL,EAAc9B,EAAcc,EAAGoB,MAC/B,MACJ,SACIJ,EAAc/B,EAEtBzC,KAAKC,QAAQ4D,WAAaW,EAE1BhB,EAAGsB,kBAGPjF,EAAcU,UAAU6D,wBAA0B,SAASxD,EAAQiD,GAC/D,MAAOjD,GAAOa,KAAOoC,GAAajD,EAAOa,KAAOzB,KAAKsB,sBAAwBuC,GAGjFlE,EAAOE,cAAgBA,GACpBF,OAAQA,OAAOC","file":"stickyheaders.min.js","sourcesContent":[";(function(window, document, undefined) {/* global WheelEvent */\n'use strict';\n\nvar SCROLL_WIDTH = (function() {\n var scrollDiv = document.createElement('div');\n scrollDiv.className = 'js-scrollbar-measure';\n document.body.appendChild(scrollDiv);\n var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;\n document.body.removeChild(scrollDiv);\n return scrollbarWidth;\n})();\n\nvar SCROLL_STEP_DEFAULT = 50;\nvar LINE_HEIGHT = 16;\n\n/**\n * This plugin enables sticky section headings on a list element.\n *\n * Supported browsers: Chrome, FF, Safari, IE11+\n *\n * @param el - list dom element\n * @param options - an option object. Supports:\n * - headerSelector - a selector string matching header elements\n */\nfunction StickyHeaders(el, options) {\n this.element = el;\n this.options = options;\n this.stuckHeadersHeight = 0;\n this._updating = false;\n\n this._readListStyles();\n\n // this.headers contains clone elements references and cached dimensions for faster scroll handling\n this.headers = Array.prototype.map.call(el.querySelectorAll(this.options.headerSelector), function(header, i) {\n var clientRect = header.getBoundingClientRect();\n\n var clone = header.cloneNode(true);\n clone.classList.add('sticky-header', 'is-stuck');\n // explicitly define the height for the clone, just in case it was applied on the original element\n // via a selector which is no longer affecting the clone\n clone.style.height = clientRect.height + 'px';\n // TODO all clones must be of equal height\n this.headerContainerHeight = clientRect.height;\n\n clone.dataset.index = i;\n return {\n top: clientRect.top - this._listStyles.top,\n height: clientRect.height,\n el: clone\n };\n }.bind(this));\n\n this._createHeaderContainer();\n\n el.addEventListener('scroll', this.onScroll.bind(this));\n}\n\nStickyHeaders.prototype._readListStyles = function() {\n var element = this.element;\n this._listStyles = {\n top: element.getBoundingClientRect().top,\n borderTopWidth: element.clientTop,\n borderLeftWidth: element.clientLeft\n };\n\n};\n\nStickyHeaders.prototype._createHeaderContainer = function() {\n var header = document.createElement('div');\n header.className = 'sticky-container';\n\n var headerWrap = document.createElement('div');\n var listBorderLeftWidth = this._listStyles.borderLeftWidth;\n headerWrap.className = 'sticky-container-inner';\n headerWrap.style.top = this._listStyles.borderTopWidth + 'px';\n headerWrap.style.left = listBorderLeftWidth + 'px';\n headerWrap.style.right = (SCROLL_WIDTH + listBorderLeftWidth) + 'px';\n headerWrap.style.height = this.headerContainerHeight + 'px';\n header.appendChild(headerWrap);\n\n var headerContainer = this.headerContainer = document.createElement('div');\n headerWrap.appendChild(headerContainer);\n\n header.addEventListener('click', this.onHeaderActivate.bind(this));\n header.addEventListener('wheel', this.onHeaderScroll.bind(this));\n\n this.element.parentNode.insertBefore(header, this.element);\n};\n\nStickyHeaders.prototype.onHeaderActivate = function(ev) {\n if (ev.target.classList.contains('is-stuck')) {\n var index = parseInt(ev.target.dataset.index, 10);\n var targetHeader = this.headers[index];\n this.element.scrollTop = targetHeader.top;\n }\n};\n\nStickyHeaders.prototype.onScroll = function() {\n this._latestKnownScrollTop = this.element.scrollTop;\n this._requestUpdate();\n};\n\nStickyHeaders.prototype._requestUpdate = function() {\n if(!this._updating) {\n setTimeout(this.updateHeaders.bind(this), 0);\n this._updating = true;\n }\n};\n\nStickyHeaders.prototype.updateHeaders = function() {\n var scrollTop = this._latestKnownScrollTop + this._listStyles.borderTopWidth;\n var shiftAmount = 0;\n\n this.headers.forEach(function(header) {\n if (!header.el.parentNode) {\n if (header.top < scrollTop) {\n this.headerContainer.appendChild(header.el);\n this.stuckHeadersHeight += header.height;\n }\n } else {\n if (header.top >= scrollTop) {\n this.headerContainer.removeChild(header.el);\n this.stuckHeadersHeight -= header.height;\n }\n }\n\n if (this.isWithinHeaderContainer(header, scrollTop)) {\n // the distance between the top of the scrollable area and the header top\n // minus the height of the header container gives the shift amount\n // for the stuck headers on in order to have an effect of a 'replacement'\n // of the old header with a new one\n shiftAmount = (header.top - scrollTop) - this.headerContainerHeight;\n }\n }, this);\n\n shiftAmount += this.headerContainerHeight - this.stuckHeadersHeight;\n\n requestAnimationFrame(function(containerOffset) {\n this.headerContainer.style.transform = 'translateY(' + containerOffset + 'px)';\n this._updating = false;\n }.bind(this, shiftAmount));\n};\n\nStickyHeaders.prototype.onHeaderScroll = function(ev) {\n var scrollDelta = 0;\n switch (ev.deltaMode) {\n case WheelEvent.DOM_DELTA_PIXEL:\n scrollDelta = ev.deltaY;\n break;\n case WheelEvent.DOM_DELTA_LINE:\n scrollDelta = LINE_HEIGHT * ev.deltaY;\n break;\n default:\n scrollDelta = SCROLL_STEP_DEFAULT;\n }\n this.element.scrollTop += scrollDelta;\n // prevent the viewport from scrolling\n ev.preventDefault();\n};\n\nStickyHeaders.prototype.isWithinHeaderContainer = function(header, scrollTop) {\n return header.top >= scrollTop && header.top <= this.headerContainerHeight + scrollTop;\n};\n\nwindow.StickyHeaders = StickyHeaders;\n})(window, window.document);"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/dist/scripts/stickyheaders.jquery.js b/dist/scripts/stickyheaders.jquery.js index d9dfd83..cc94646 100644 --- a/dist/scripts/stickyheaders.jquery.js +++ b/dist/scripts/stickyheaders.jquery.js @@ -162,6 +162,8 @@ StickyHeaders.prototype.isWithinHeaderContainer = function(header, scrollTop) { return header.top >= scrollTop && header.top <= this.headerContainerHeight + scrollTop; }; +window.StickyHeaders = StickyHeaders; + var pluginName = 'stickyHeaders'; function Plugin(element, options) { diff --git a/dist/scripts/stickyheaders.jquery.min.js b/dist/scripts/stickyheaders.jquery.min.js index 28a7dfa..2803fe2 100644 --- a/dist/scripts/stickyheaders.jquery.min.js +++ b/dist/scripts/stickyheaders.jquery.min.js @@ -1,2 +1,2 @@ -!function(t,e,i,n){"use strict";function s(t,e){this.element=t,this.options=e,this.stuckHeadersHeight=0,this._updating=!1,this._readListStyles(),this.headers=Array.prototype.map.call(t.querySelectorAll(this.options.headerSelector),function(t,e){var i=t.getBoundingClientRect(),n=t.cloneNode(!0);return n.classList.add("sticky-header","is-stuck"),n.style.height=i.height+"px",this.headerContainerHeight=i.height,n.dataset.index=e,{top:i.top-this._listStyles.top,height:i.height,el:n}}.bind(this)),this._createHeaderContainer(),t.addEventListener("scroll",this.onScroll.bind(this))}function o(t,e){this.element=t,this.options=e,this.init()}var r=function(){var t=i.createElement("div");t.className="js-scrollbar-measure",i.body.appendChild(t);var e=t.offsetWidth-t.clientWidth;return i.body.removeChild(t),e}(),a=50,h=16;s.prototype._readListStyles=function(){var t=this.element;this._listStyles={top:t.getBoundingClientRect().top,borderTopWidth:t.clientTop,borderLeftWidth:t.clientLeft}},s.prototype._createHeaderContainer=function(){var t=i.createElement("div");t.className="sticky-container";var e=i.createElement("div"),n=this._listStyles.borderLeftWidth;e.className="sticky-container-inner",e.style.top=this._listStyles.borderTopWidth+"px",e.style.left=n+"px",e.style.right=r+n+"px",e.style.height=this.headerContainerHeight+"px",t.appendChild(e);var s=this.headerContainer=i.createElement("div");e.appendChild(s),t.addEventListener("click",this.onHeaderActivate.bind(this)),t.addEventListener("wheel",this.onHeaderScroll.bind(this)),this.element.parentNode.insertBefore(t,this.element)},s.prototype.onHeaderActivate=function(t){if(t.target.classList.contains("is-stuck")){var e=parseInt(t.target.dataset.index,10),i=this.headers[e];this.element.scrollTop=i.top}},s.prototype.onScroll=function(){this._latestKnownScrollTop=this.element.scrollTop,this._requestUpdate()},s.prototype._requestUpdate=function(){this._updating||(setTimeout(this.updateHeaders.bind(this),0),this._updating=!0)},s.prototype.updateHeaders=function(){var t=this._latestKnownScrollTop+this._listStyles.borderTopWidth,e=0;this.headers.forEach(function(i){i.el.parentNode?i.top>=t&&(this.headerContainer.removeChild(i.el),this.stuckHeadersHeight-=i.height):i.top=e&&t.top<=this.headerContainerHeight+e};var d="stickyHeaders";o.prototype.init=function(){this.akno=new s(this.element,this.options)},o.prototype.destroy=function(){this.akno.destroy(),t.removeData(this.element,"plugin_"+d),this.element=null},t.fn[d]=function(e){var i=arguments,s="plugin_"+d;return e===n||"object"==typeof e?this.each(function(){t.data(this,s)||t.data(this,s,new o(this,e))}):"string"==typeof e&&"_"!==e[0]&&"init"!==e?this.each(function(){var n=t.data(this,s);n instanceof o&&(!t.isFunction(n[e])&&t.isFunction(n.akno[e])&&(n=n.akno),n[e].apply(n,Array.prototype.slice.call(i,1)))}):void 0}}(jQuery,window,window.document); +!function(t,e,i,n){"use strict";function s(t,e){this.element=t,this.options=e,this.stuckHeadersHeight=0,this._updating=!1,this._readListStyles(),this.headers=Array.prototype.map.call(t.querySelectorAll(this.options.headerSelector),function(t,e){var i=t.getBoundingClientRect(),n=t.cloneNode(!0);return n.classList.add("sticky-header","is-stuck"),n.style.height=i.height+"px",this.headerContainerHeight=i.height,n.dataset.index=e,{top:i.top-this._listStyles.top,height:i.height,el:n}}.bind(this)),this._createHeaderContainer(),t.addEventListener("scroll",this.onScroll.bind(this))}function o(t,e){this.element=t,this.options=e,this.init()}var r=function(){var t=i.createElement("div");t.className="js-scrollbar-measure",i.body.appendChild(t);var e=t.offsetWidth-t.clientWidth;return i.body.removeChild(t),e}(),a=50,h=16;s.prototype._readListStyles=function(){var t=this.element;this._listStyles={top:t.getBoundingClientRect().top,borderTopWidth:t.clientTop,borderLeftWidth:t.clientLeft}},s.prototype._createHeaderContainer=function(){var t=i.createElement("div");t.className="sticky-container";var e=i.createElement("div"),n=this._listStyles.borderLeftWidth;e.className="sticky-container-inner",e.style.top=this._listStyles.borderTopWidth+"px",e.style.left=n+"px",e.style.right=r+n+"px",e.style.height=this.headerContainerHeight+"px",t.appendChild(e);var s=this.headerContainer=i.createElement("div");e.appendChild(s),t.addEventListener("click",this.onHeaderActivate.bind(this)),t.addEventListener("wheel",this.onHeaderScroll.bind(this)),this.element.parentNode.insertBefore(t,this.element)},s.prototype.onHeaderActivate=function(t){if(t.target.classList.contains("is-stuck")){var e=parseInt(t.target.dataset.index,10),i=this.headers[e];this.element.scrollTop=i.top}},s.prototype.onScroll=function(){this._latestKnownScrollTop=this.element.scrollTop,this._requestUpdate()},s.prototype._requestUpdate=function(){this._updating||(setTimeout(this.updateHeaders.bind(this),0),this._updating=!0)},s.prototype.updateHeaders=function(){var t=this._latestKnownScrollTop+this._listStyles.borderTopWidth,e=0;this.headers.forEach(function(i){i.el.parentNode?i.top>=t&&(this.headerContainer.removeChild(i.el),this.stuckHeadersHeight-=i.height):i.top=e&&t.top<=this.headerContainerHeight+e},e.StickyHeaders=s;var d="stickyHeaders";o.prototype.init=function(){this.akno=new s(this.element,this.options)},o.prototype.destroy=function(){this.akno.destroy(),t.removeData(this.element,"plugin_"+d),this.element=null},t.fn[d]=function(e){var i=arguments,s="plugin_"+d;return e===n||"object"==typeof e?this.each(function(){t.data(this,s)||t.data(this,s,new o(this,e))}):"string"==typeof e&&"_"!==e[0]&&"init"!==e?this.each(function(){var n=t.data(this,s);n instanceof o&&(!t.isFunction(n[e])&&t.isFunction(n.akno[e])&&(n=n.akno),n[e].apply(n,Array.prototype.slice.call(i,1)))}):void 0}}(jQuery,window,window.document); //# sourceMappingURL=../maps/stickyheaders.jquery.min.js.map \ No newline at end of file diff --git a/dist/scripts/stickyheaders.js b/dist/scripts/stickyheaders.js index d292898..490402e 100644 --- a/dist/scripts/stickyheaders.js +++ b/dist/scripts/stickyheaders.js @@ -161,4 +161,6 @@ StickyHeaders.prototype.onHeaderScroll = function(ev) { StickyHeaders.prototype.isWithinHeaderContainer = function(header, scrollTop) { return header.top >= scrollTop && header.top <= this.headerContainerHeight + scrollTop; }; + +window.StickyHeaders = StickyHeaders; })(window, window.document); \ No newline at end of file diff --git a/dist/scripts/stickyheaders.min.js b/dist/scripts/stickyheaders.min.js index c84661c..ab570b4 100644 --- a/dist/scripts/stickyheaders.min.js +++ b/dist/scripts/stickyheaders.min.js @@ -1,2 +1,2 @@ -!function(e,t){"use strict";function i(e,t){this.element=e,this.options=t,this.stuckHeadersHeight=0,this._updating=!1,this._readListStyles(),this.headers=Array.prototype.map.call(e.querySelectorAll(this.options.headerSelector),function(e,t){var i=e.getBoundingClientRect(),n=e.cloneNode(!0);return n.classList.add("sticky-header","is-stuck"),n.style.height=i.height+"px",this.headerContainerHeight=i.height,n.dataset.index=t,{top:i.top-this._listStyles.top,height:i.height,el:n}}.bind(this)),this._createHeaderContainer(),e.addEventListener("scroll",this.onScroll.bind(this))}var n=function(){var e=t.createElement("div");e.className="js-scrollbar-measure",t.body.appendChild(e);var i=e.offsetWidth-e.clientWidth;return t.body.removeChild(e),i}(),s=50,r=16;i.prototype._readListStyles=function(){var e=this.element;this._listStyles={top:e.getBoundingClientRect().top,borderTopWidth:e.clientTop,borderLeftWidth:e.clientLeft}},i.prototype._createHeaderContainer=function(){var e=t.createElement("div");e.className="sticky-container";var i=t.createElement("div"),s=this._listStyles.borderLeftWidth;i.className="sticky-container-inner",i.style.top=this._listStyles.borderTopWidth+"px",i.style.left=s+"px",i.style.right=n+s+"px",i.style.height=this.headerContainerHeight+"px",e.appendChild(i);var r=this.headerContainer=t.createElement("div");i.appendChild(r),e.addEventListener("click",this.onHeaderActivate.bind(this)),e.addEventListener("wheel",this.onHeaderScroll.bind(this)),this.element.parentNode.insertBefore(e,this.element)},i.prototype.onHeaderActivate=function(e){if(e.target.classList.contains("is-stuck")){var t=parseInt(e.target.dataset.index,10),i=this.headers[t];this.element.scrollTop=i.top}},i.prototype.onScroll=function(){this._latestKnownScrollTop=this.element.scrollTop,this._requestUpdate()},i.prototype._requestUpdate=function(){this._updating||(setTimeout(this.updateHeaders.bind(this),0),this._updating=!0)},i.prototype.updateHeaders=function(){var e=this._latestKnownScrollTop+this._listStyles.borderTopWidth,t=0;this.headers.forEach(function(i){i.el.parentNode?i.top>=e&&(this.headerContainer.removeChild(i.el),this.stuckHeadersHeight-=i.height):i.top=t&&e.top<=this.headerContainerHeight+t}}(window,window.document); +!function(e,t){"use strict";function i(e,t){this.element=e,this.options=t,this.stuckHeadersHeight=0,this._updating=!1,this._readListStyles(),this.headers=Array.prototype.map.call(e.querySelectorAll(this.options.headerSelector),function(e,t){var i=e.getBoundingClientRect(),s=e.cloneNode(!0);return s.classList.add("sticky-header","is-stuck"),s.style.height=i.height+"px",this.headerContainerHeight=i.height,s.dataset.index=t,{top:i.top-this._listStyles.top,height:i.height,el:s}}.bind(this)),this._createHeaderContainer(),e.addEventListener("scroll",this.onScroll.bind(this))}var s=function(){var e=t.createElement("div");e.className="js-scrollbar-measure",t.body.appendChild(e);var i=e.offsetWidth-e.clientWidth;return t.body.removeChild(e),i}(),n=50,r=16;i.prototype._readListStyles=function(){var e=this.element;this._listStyles={top:e.getBoundingClientRect().top,borderTopWidth:e.clientTop,borderLeftWidth:e.clientLeft}},i.prototype._createHeaderContainer=function(){var e=t.createElement("div");e.className="sticky-container";var i=t.createElement("div"),n=this._listStyles.borderLeftWidth;i.className="sticky-container-inner",i.style.top=this._listStyles.borderTopWidth+"px",i.style.left=n+"px",i.style.right=s+n+"px",i.style.height=this.headerContainerHeight+"px",e.appendChild(i);var r=this.headerContainer=t.createElement("div");i.appendChild(r),e.addEventListener("click",this.onHeaderActivate.bind(this)),e.addEventListener("wheel",this.onHeaderScroll.bind(this)),this.element.parentNode.insertBefore(e,this.element)},i.prototype.onHeaderActivate=function(e){if(e.target.classList.contains("is-stuck")){var t=parseInt(e.target.dataset.index,10),i=this.headers[t];this.element.scrollTop=i.top}},i.prototype.onScroll=function(){this._latestKnownScrollTop=this.element.scrollTop,this._requestUpdate()},i.prototype._requestUpdate=function(){this._updating||(setTimeout(this.updateHeaders.bind(this),0),this._updating=!0)},i.prototype.updateHeaders=function(){var e=this._latestKnownScrollTop+this._listStyles.borderTopWidth,t=0;this.headers.forEach(function(i){i.el.parentNode?i.top>=e&&(this.headerContainer.removeChild(i.el),this.stuckHeadersHeight-=i.height):i.top=t&&e.top<=this.headerContainerHeight+t},e.StickyHeaders=i}(window,window.document); //# sourceMappingURL=../maps/stickyheaders.min.js.map \ No newline at end of file diff --git a/src/scripts/main.js b/src/scripts/main.js index 59c9766..34b9a77 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -161,3 +161,5 @@ StickyHeaders.prototype.onHeaderScroll = function(ev) { StickyHeaders.prototype.isWithinHeaderContainer = function(header, scrollTop) { return header.top >= scrollTop && header.top <= this.headerContainerHeight + scrollTop; }; + +window.StickyHeaders = StickyHeaders;