Refactored nav toggle and cart toggle javascript