navbar directive pins and unpins at the wrong spot