moved menu DOM append out of event listener to function