Refine js for swiping.