Move Javascript

Move `#nav` specific Javascript into `if` block