Refactor js with jquery, more smooth and attractive