@talentsoft-opensource/uxp-themes
Version:
Talentsoft UX themes
25 lines (24 loc) • 804 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var Stats_bar_1 = require("./Stats-bar");
var ScrollAction = /** @class */ (function () {
function ScrollAction(element) {
var options = {
threshold: 0.2
};
var callback = function (entries) {
entries.forEach(function (entry) {
if (entry.intersectionRatio > 0) {
new Stats_bar_1.default(entry.target);
}
});
};
var observer = new IntersectionObserver(callback, options);
var $target = document.querySelectorAll('.stats-bar');
$target.forEach(function ($item) {
observer.observe($item);
});
}
return ScrollAction;
}());
exports.default = ScrollAction;