In Western society today there is no denying that, following the economic crash of 2008 and its continued after-effects, it takes a little longer to reach the heady heights of what is traditionally recognised as adulthood. Now milestones such as graduating from school or university, finding a paying job, buying a home, getting married and having children are, for various reasons, a little harder to achieve. With the rising cost of education in the UK and US, a scarcity of well-paid work, fiercer competition, increasing house prices and more liberal sexual attitudes, it is taking millennials longer to become adults.
For the generation of students that graduated during the economic recession, this is particularly true. In the US, where home ownership is traditionally encouraged early in adulthood, the last decade has seen a consistent rise in renting among young people. House sales reached a peak in the US a decade ago but the housing bubble burst and credit has since been hard to come by. This hit young would-be buyers the hardest and as a result they began renting instead.
// Add an event listener for the scroll event on the window.
window.addEventListener("scroll", () => {
// Get the current scroll position.
let scrollTop = window.scrollY;
// Get the total height of the document.
let docHeight = document.body.offsetHeight;
// Get the height of the window.
let winHeight = window.innerHeight;
// Calculate the percentage of the page that has been scrolled.
let scrollPercent = scrollTop / (docHeight - winHeight);
let scrollPercentRounded = Math.round(scrollPercent * 100);
// Try to open the popup if the visitor has scrolled more than 25% of the page and is not a member.
if (scrollPercentRounded > 25) {
openPopup();
}
});