Move window scroll and resize binding inside jquery function