How to add a dynamic javascript snippet to the footer that requires jQuery

You can obviously do it the way you did. However, there is a better way, that is much more maintainable than adding the script tag in the footer that way.

You can handle these sort of scenario (where you need dynamic variable from PHP) by using wp_localize_script() function.

For example, in functions.php:

function theme_wp_footer_scripts() {
    /* your custom CODE */
    if ( $body_logged_in == 'on' ) {
        $count = 60;
    } else {
        $count = 90;    
    }
    if ( $navbar_sticky == 'on' ) {
        $count = $count + 45;
    }

    /* add main script in footer */
    wp_enqueue_script( 'footer_script', get_stylesheet_directory_uri() . '/js/my-script.js', array( 'jquery' ), null, true );

    /* add dynamic data for your footer_script with object name footer_script_data */
    wp_localize_script( 'footer_script', 'footer_script_data',
        array( 
            'count' => $count
        )
    );
}
add_action( 'wp_enqueue_scripts', 'theme_wp_footer_scripts' );

Then in js/my-script.js:

jQuery(document).ready(function($) {

    /* Your custom JavaScript CODE that is jQuery dependent */
    /* see how footer_script_data object name is used from external JavaScript file */
    $('.fixed-sidebar').stick_in_parent({offset_top: footer_script_data.count});    

});

Here’s more about wp_localize_script.