for (i = 0; i <= portfolio_div_el.length; i++) {
if (posTop > scrollPos){
console.log(scrollPos);
scroll_down();
} else {
console.log(scrollPos)
scroll_up();
}
}
scrollPos = posTop;
var scrollPos = 0;
var portfolio_div_el = document.getElementById('portfolio').children;
function scroll_down() {
var cord_y_top = Math.round(portfolio_div_el[i].offsetTop);
if ((posTop + 500) > cord_y_top ) {
portfolio_div_el[i].style.transform = "translateY(0)";
}
//console.log('elem' + scrollPos);
}
function scroll_up() {
var cord_y_top = Math.round(portfolio_div_el[i].offsetTop);
var el_cord_top = Math.round(portfolio_div_el[i].getBoundingClientRect().bottom + posTop);
var el_cord_bottom = Math.round(portfolio_div_el[i].getBoundingClientRect().top + posTop);
if (posTop > el_cord_top ) {
portfolio_div_el[i].style.transform = "translateY(0)";
} else if (posTop < el_cord_top ) {
portfolio_div_el[i].style.transform = "translateY(15px)";
}
}
window.addEventListener('scroll', function() {
posTop = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
for (i = 0; i <= portfolio_div_el.length; i++) {
if (posTop > scrollPos){
<b>scroll_down();</b>
} else {
<b>scroll_up();</b>
}
}
scrollPos = posTop;
});