#FIX
1. Always load jquery ui on footer like this
wp_enqueue_script( 'jquery-ui-script', get_template_directory_uri() . '/js/jquery-ui.min.js', array('jquery'), 1.12.1, true );
2. make sure your jquery UI code inside this block
(function($) { "use strict"; // A $( document ).ready() block. $( document ).ready(function() { //jquery UI code should be here }); })(jQuery);