wix-storybook-utils
Version:
Utilities for automated component documentation within Storybook
20 lines • 513 B
JavaScript
var scrollToElement = function (element) {
element.scrollIntoView({
behavior: 'smooth',
inline: 'nearest',
});
};
export var scrollToElementByHash = function () {
var url = new URL(window.parent.location);
if (!url.hash) {
return;
}
setTimeout(function () {
var element = document.getElementById(url.hash.substring(1));
if (!element) {
return;
}
scrollToElement(element);
}, 600);
};
//# sourceMappingURL=utils.js.map