storybook/docs/gatsby-browser.js

12 lines
239 B
JavaScript
Raw Normal View History

2017-06-03 21:03:48 +02:00
const global = require('global');
2017-06-06 18:03:32 +02:00
const document = global.document;
2017-06-03 21:03:48 +02:00
exports.onRouteUpdate = location => {
if (location.hash) {
setTimeout(() => {
document.querySelector(`${location.hash}`).scrollIntoView();
}, 0);
}
};