Cannot read property 'addClass' of undefined with smoothState.js in Wordpress
<p>I'm trying to implement smoothState.js into a custom WordPress theme. I'm flummoxed. I feel like my code is correct according to the smoothState documentation, but it's still producing an error. But I'm still a beginner at JS/JQuery and scripting in general so I'm probably missing something.</p>

<p>Using JQMigrate version 1.4.1 and JQuery 1.12.4 in noConflict mode. WordPress is 4.6.1.</p>

<pre><code>jQuery(document).ready(function($){ // WordPress doesn't release $ so we need this line
$(function() {
    var $body = $('html, body'),
    content = $('#wrapper').smoothState({
        prefetch: true,
        pageCacheSize: 4,
        debug: true,
        // onStart is for when a link is clicked
        onStart: {
            duration: 2500, // animation duration in ms
            render: function (url, $container) {
                $container.addClass('is-exiting');
                $body.animate({
                    scrollTop: 0
                });
                smoothState.restartCSSAnimations();
            }
        },
        onEnd : {
            duration: 1500, \
            render: function (url, $container, $content) {
                $container.removeClass('is-exiting');
                $body.css('cursor', 'auto');
                $body.find('a').css('cursor', 'auto');
                $container.html($content);
                // Trigger document.ready and window.load
                $(document).ready();
                $(window).trigger('load');
            }
        },
        onAfter : function(url, $container, $content) {

        }
    }).data('smoothState');
});

(function($, undefined) {
    var isFired = false;
    var oldReady = jQuery.fn.ready;
    $(function() {
        isFired = true;
        $(document).ready();
    });
    jQuery.fn.ready = function(fn) {
        if(fn === undefined) {
            $(document).trigger('_is_ready');
            return;
        }
        if(isFired) {
            window.setTimeout(fn, 1);
        }
        $(document).bind('_is_ready', fn);
    };
})(jQuery);

});
</code></pre>

<p>Clicking any hyperlink inside #wrapper throws the following console error...</p>

<pre><code>Uncaught TypeError: Cannot read property 'addClass' of undefined
    w @ jquery.smoothState.min.js:9
    b @ jquery.smoothState.min.js:9
    dispatch @ jquery.js?ver=1.12.4:3
    r.handle @ jquery.js?ver=1.12.4:3
</code></pre>

<p>I've checked for any potential plugin or theme conflicts and found none. I've even tried explicitly declaring the container like <code>var $container = $("#wrapper");</code> but still get the same results. Any ideas?</p>