'cannot call methods on tooltip prior to initialization' error when I add the jquery-ui library
<p>I get the 'cannot call methods on tooltip prior to initialization' error when I add the jquery-ui library to my loaded scripts. Without it everything works fine.</p>

<p>What could be the cause of this?</p>

<p>The error:</p>

<pre><code>Uncaught Error: cannot call methods on tooltip prior to initialization; attempted to call method 'show'
n.extend.error @ jquery.min.js:2

(anonymous function) @ jquery-ui.min.js:6

n.extend.each @ jquery.min.js:2

n.fn.n.each @ jquery.min.js:2

e.fn.(anonymous function) @ jquery-ui.min.js:6

(anonymous function) @ scrolltop.js:20

i @ jquery.min.js:2

j.fireWith @ jquery.min.js:2

n.extend.ready @ jquery.min.js:2J @ jquery.min.js:2
</code></pre>

<p>The scripts that I load at bottom of page are:</p>

<pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"&gt;&lt;/script&gt;

&lt;script src="{{ asset('assets/js/bootstrap.min.js') }}" type="text/javascript"&gt;&lt;/script&gt;

&lt;script src="{{ asset('assets/vendors/livicons/minified/raphael-min.js') }}"&gt;&lt;/script&gt;

&lt;script src="{{ asset('assets/vendors/livicons/minified/livicons-1.4.min.js') }}"&gt;&lt;/script&gt;

&lt;script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"&gt;&lt;/script&gt; //If I remove this everything works fine.

&lt;script type="text/javascript" src="{{ asset('assets/js/frontend/scrolltop.js') }}"&gt;&lt;/script&gt;//If I remove this but and keep jqueryui I also dont get error.
</code></pre>

<hr>

<p>My scrolltop.js code is:</p>

<pre><code>$(document).ready(function(){
     $(window).scroll(function () {
            if ($(this).scrollTop() &gt; 50) {
                $('#back-to-top').fadeIn();
            } else {
                $('#back-to-top').fadeOut();
            }
        });
        // scroll body to 0px on click
        $('#back-to-top').click(function () {
            $('#back-to-top').tooltip('hide');
            $('body,html').animate({
                scrollTop: 0
            }, 800);
            return false;
        });

        $('#back-to-top').tooltip('show'); //This is the line that seems to trigger the error.
});
$(document).ready(function() {
        $(".dropdown").hover(
            function() {
                $('.dropdown-menu', this).not('.in .dropdown-menu').stop(true, true).slideDown("fast");
                $(this).toggleClass('open');
            },
            function() {
                $('.dropdown-menu', this).not('.in .dropdown-menu').stop(true, true).slideUp("fast");
                $(this).toggleClass('open');
            }
        );
    });
</code></pre>