@dotdev/limelight
Advanced tools
Comparing version 2.2.2 to 2.2.3
@@ -13,3 +13,3 @@ "use strict"; | ||
Limelight | ||
version v2.2.0 | ||
version v2.2.3 | ||
Author: George Butter | ||
@@ -180,2 +180,4 @@ https://github.com/ButsAndCats/limelight | ||
Limelight.prototype.buildEventListeners = function bindLimelightEventListeners() { | ||
var _this = this; | ||
function on(eventName, selector, fn) { | ||
@@ -224,2 +226,8 @@ document.body.addEventListener(eventName, function (event) { | ||
on('mouseenter', "[data-trigger][data-target=\"".concat(this.target, "\"]"), hoverFunction); | ||
} | ||
if (this.settings.slide) { | ||
window.addEventListener('resize', function () { | ||
return _this.adjustSlideHeight(); | ||
}); | ||
} // If the element is intialized visible then create an event listener for closing | ||
@@ -342,2 +350,9 @@ | ||
Limelight.prototype.adjustSlideHeight = function adjustSlideHeight() { | ||
if (!this.visible) return; | ||
var el = this.slideElement; | ||
var height = "".concat(el.scrollHeight, "px"); | ||
el.style.height = height; | ||
}; | ||
Limelight.prototype.slideUp = function slideUp() { | ||
@@ -344,0 +359,0 @@ var el = this.slideElement; |
/* ===================================================================================== @preserve = | ||
Limelight | ||
version v2.2.0 | ||
version v2.2.3 | ||
Author: George Butter | ||
@@ -114,2 +114,3 @@ https://github.com/ButsAndCats/limelight | ||
} | ||
/* | ||
@@ -137,2 +138,3 @@ If the element does not exist then it is being fired directly from a data attribute. | ||
} | ||
/* | ||
@@ -152,2 +154,3 @@ When clicking on a close button or out element | ||
} | ||
/* | ||
@@ -163,2 +166,3 @@ On key up event check if the user has pressed escape | ||
} | ||
/* | ||
@@ -170,6 +174,6 @@ Build the event listeners | ||
function on (eventName, selector, fn) { | ||
document.body.addEventListener(eventName, function (event) { | ||
document.body.addEventListener(eventName, (event) => { | ||
const possibleTargets = document.body.querySelectorAll(selector) | ||
const target = event.target | ||
for (var i = 0, l = possibleTargets.length; i < l; i++) { | ||
for (let i = 0, l = possibleTargets.length; i < l; i++) { | ||
let el = target | ||
@@ -213,2 +217,6 @@ const p = possibleTargets[i] | ||
if (this.settings.slide) { | ||
window.addEventListener('resize', () => this.adjustSlideHeight()) | ||
} | ||
// If the element is intialized visible then create an event listener for closing | ||
@@ -222,2 +230,3 @@ if (this.closeElements && this.settings.visible) { | ||
} | ||
/* | ||
@@ -234,2 +243,3 @@ Add a class to a given element | ||
} | ||
/* | ||
@@ -246,2 +256,3 @@ Remove a class from a given element | ||
} | ||
/* | ||
@@ -281,3 +292,3 @@ Show the popup element | ||
if (focusEl) { | ||
setTimeout(function () { | ||
setTimeout(() => { | ||
focusEl.focus() | ||
@@ -322,2 +333,9 @@ }, 300) | ||
Limelight.prototype.adjustSlideHeight = function adjustSlideHeight () { | ||
if (!this.visible) return | ||
const el = this.slideElement | ||
const height = `${el.scrollHeight}px` | ||
el.style.height = height | ||
} | ||
Limelight.prototype.slideUp = function slideUp () { | ||
@@ -381,2 +399,3 @@ const el = this.slideElement | ||
} | ||
/* | ||
@@ -395,2 +414,3 @@ Show if hidden, hide if shown. | ||
} | ||
/* | ||
@@ -405,2 +425,2 @@ Move the element to the end of the body, sometime useful for popups. | ||
export default Limelight | ||
export default Limelight |
@@ -57,3 +57,3 @@ { | ||
}, | ||
"version": "2.2.2" | ||
"version": "2.2.3" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40047
826