You can place the code in the header.php file within the head section, but after the jquery.js file. However, if you only need this code on one page, you could just place it in that page within script tags. As long as you are using $(document).ready(function(), it doesn't matter where it is placed (head section, body). Although some like to place their javascript in the head section.
Alternatively you can have a php condition in the header.php file. For example: if ($page == '#PAGE_ID') { // your jquery code }