updateActivePage = () => {
const blockElements = document.getElementsByClassName("block");
let activeIndex;
Array.prototype.forEach.call(blockElements, (element, index) => {
const rect = element.getBoundingClientRect();
if (rect.top + rect.bottom > 0) {
if (activeIndex === undefined) activeIndex = index;
}
});
this.setState({ activeIndex });
};