Oxygen页面形状分割滚动变形动画

页面内插入任意形状分割, 页面滚动的时候,分割线动态变形

插入代码块

输入以下js

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';
	})
}
×