Javascript dynamic scroll ajustements