move auto-stop-scroll code to the same event to prevent errors.