added main logic for front page scroll