You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
638 B
27 lines
638 B
(function() {
|
|
var elements;
|
|
var windowHeight;
|
|
|
|
function init() {
|
|
elements = document.querySelectorAll('.he');
|
|
windowHeight = window.innerHeight;
|
|
}
|
|
|
|
function checkPosition() {
|
|
for (var i = 0; i < elements.length; i++) {
|
|
var element = elements[i];
|
|
var positionFromTop = elements[i].getBoundingClientRect().top;
|
|
|
|
if (positionFromTop - windowHeight <= 0) {
|
|
element.classList.add('tracking-in-expand');
|
|
element.classList.remove('he');
|
|
}
|
|
}
|
|
}
|
|
|
|
window.addEventListener('scroll', checkPosition);
|
|
window.addEventListener('resize', init);
|
|
|
|
init();
|
|
checkPosition();
|
|
})();
|
|
|