finally fixed smoothScrollBy function