Add javascript function to child theme

Hi! I've created a child theme and I'm trying to set up some JS to show/hide the navigation bar (the theme is based on bootstrap).

I've got this script:

$(function() {
    var showinghead = $(".clearhead");
    $(window).scroll(function() {
        var scroll = $(window).scrollTop();

        if (scroll >= 50) {
            head.removeClass('clearhead').addClass("showhead");
        } else {
            head.removeClass("showhead").addClass('clearhead');
        }
    });
});

It's located on child theme root /js/showmenu.js
So, I've read that the best choice is to add it to the functions.php file instead of doing it directly on the head.php of the child theme.
Right now it's the only function there, so it (functions.php) looks like this:

<?php
add_action ( 'wp_enqueue_scripts', 'showmenu_scripts' );

function showmenu_scripts() {
	wp_register_script('showmenu', get_stylesheet_directory_uri() . '/js/showmenu.js' );
}

?>

I think there's something that I'm missing, since it's not really working. Since it doesn't remove/change the classes.
Any corrections/toughts?

Thanks!