Adding javascript to functions.php causes problems with my template

jQuery is already loaded with WordPress, so you won’t need <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

When using jQuery with WordPress, you’ll likely require no-conflict wrappers : https://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_Wrappers

There are likely JS errors being outputted in your browser console, so giving us more info on errors can prove useful as well.

There is definitely a better way – starting with this guide for enqueuing Javascript should give you solid grounds to understanding WP scripts a little better : http://www.wpbeginner.com/wp-tutorials/how-to-properly-add-javascripts-and-styles-in-wordpress/