Fix responsive navbar and refactor code js