JS Scroll

Fixed all the bugs and optimized the functions.