Skip to content

Instantly share code, notes, and snippets.

@KittenCodes
Created September 5, 2021 06:58
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save KittenCodes/5ce62c1455ebd5728eaea489b517de28 to your computer and use it in GitHub Desktop.
Save KittenCodes/5ce62c1455ebd5728eaea489b517de28 to your computer and use it in GitHub Desktop.
Change the height of Oxygen's Shape Dividers on scroll
var ready = (callback) => {
if (document.readyState != 'loading') callback();
else document.addEventListener('DOMContentLoaded', callback);
}
ready ( () => {
if (window.angular) { return; }
calcHeight();
})
document.addEventListener('scroll', function() {
if (window.angular) { return; }
calcHeight();
})
function calcHeight() {
document.querySelectorAll('.oxy-shape-divider').forEach( shape => {
var top = shape.getBoundingClientRect().top;
shape.querySelector('svg').style.height = top / 3 + 'px';
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment