Difference between revisions of "Template:Humboldt Berlin"

Line 26: Line 26:
 
</head>
 
</head>
  
 +
<script>
 +
(function () {
 +
  document.querySelector('.no-js').classList.add('js')
 +
  document.querySelector('.no-js').classList.remove('no-js')
 +
}())
 +
 +
window.addEventListener("scroll", function () {
 +
  const elements = document.querySelectorAll('.is-revealing');
 +
 +
  [].forEach.call(elements, function(el) {
 +
    if (isElementVisible(el)) {
 +
      el.classList.add('is-revealing-visible')
 +
    }
 +
  });
 +
});
 +
 +
function isElementVisible(el) {
 +
  var top = el.offsetTop;
 +
  var height = el.offsetHeight;
 +
 +
  while(el.offsetParent) {
 +
    el = el.offsetParent;
 +
    top += el.offsetTop;
 +
  }
 +
 +
  return (
 +
    (top + height) <= (window.pageYOffset + window.innerHeight) + 100
 +
  );
 +
}
 +
</script>
  
 
<!------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
 
<!------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->

Revision as of 06:01, 25 June 2019