2016-07-27
Heinrich Heine, "Briefe aus Berlin"'s Archives
function scrollSectionContent() { var delay = 100; //Get query parameters function getUrlVars() { var vars = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) { vars[key] = value; }); return vars; } var page = getUrlVars()["p"]; if (typeof page == "undefined") { page = getUrlVars()["ap"]; } // Scroll down to the paginated content if (page != null && page.length > 0) { setTimeout(function () { function offset(el) { var rect = el.getBoundingClientRect(), scrollTop = window.pageYOffset || document.documentElement.scrollTop; return { top: rect.top + scrollTop } } var div = document.getElementById("scrollToHere"); var divOffset = offset(div); window.scrollTo(0, divOffset.top); }, delay); } }