Skip to content

Instantly share code, notes, and snippets.

@cedeber
Created June 27, 2017 13:17
Show Gist options
  • Save cedeber/7c9c6678a26a0fbefdadf32c4086e759 to your computer and use it in GitHub Desktop.
Save cedeber/7c9c6678a26a0fbefdadf32c4086e759 to your computer and use it in GitHub Desktop.
Image as Hero
(function() {
var image = document.getElementById("image-${content.@id}");
var imageTop = (function() {
var element = image, top = element.offsetTop;
while ((element = element.offsetParent) !== null && element !== document.body) { top += element.offsetTop; }
return top;
}());
image.style.height = (window.innerHeight - imageTop) + "px";
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment