Auto scrolling improvement

Switched to jquery function